1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

PacketWriter: avoid use-after-free on error in init

This commit is contained in:
Derrick Lyndon Pallas
2019-04-11 18:11:25 +00:00
parent d74520768b
commit 0c40a0714b

View File

@@ -86,8 +86,9 @@ void PacketWriter::init(const string& file_name, int link_type) {
}
dumper_ = pcap_dump_open(handle_, file_name.c_str());
if (!dumper_) {
string error(pcap_geterr(handle_));
pcap_close(handle_);
throw pcap_error(pcap_geterr(handle_));
throw pcap_error(error);
}
}