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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user