diff --git a/3rdParty/LightPcapNg/LightPcapNg/src/light_pcapng_ext.c b/3rdParty/LightPcapNg/LightPcapNg/src/light_pcapng_ext.c index af8a382db7..11050c360e 100644 --- a/3rdParty/LightPcapNg/LightPcapNg/src/light_pcapng_ext.c +++ b/3rdParty/LightPcapNg/LightPcapNg/src/light_pcapng_ext.c @@ -558,7 +558,8 @@ void light_pcapng_close(light_pcapng_t *pcapng) light_flush(pcapng->file); light_close(pcapng->file); } - light_free_file_info(pcapng->file_info); + if (pcapng->file_info != NULL) + light_free_file_info(pcapng->file_info); free(pcapng); } diff --git a/Pcap++/src/PcapFileDevice.cpp b/Pcap++/src/PcapFileDevice.cpp index 54302e4494..2e361353cd 100644 --- a/Pcap++/src/PcapFileDevice.cpp +++ b/Pcap++/src/PcapFileDevice.cpp @@ -439,6 +439,8 @@ std::string PcapNgFileReaderDevice::getOS() const } light_pcapng_file_info* fileInfo = light_pcang_get_file_info((light_pcapng_t*)m_LightPcapNg); + if (fileInfo == nullptr) + return ""; char* res = fileInfo->os_desc; size_t len = fileInfo->os_desc_size; if (len == 0 || res == nullptr) @@ -456,6 +458,8 @@ std::string PcapNgFileReaderDevice::getHardware() const } light_pcapng_file_info* fileInfo = light_pcang_get_file_info((light_pcapng_t*)m_LightPcapNg); + if (fileInfo == nullptr) + return ""; char* res = fileInfo->hardware_desc; size_t len = fileInfo->hardware_desc_size; if (len == 0 || res == nullptr) @@ -473,6 +477,8 @@ std::string PcapNgFileReaderDevice::getCaptureApplication() const } light_pcapng_file_info* fileInfo = light_pcang_get_file_info((light_pcapng_t*)m_LightPcapNg); + if (fileInfo == nullptr) + return ""; char* res = fileInfo->user_app_desc; size_t len = fileInfo->user_app_desc_size; if (len == 0 || res == nullptr) @@ -490,6 +496,8 @@ std::string PcapNgFileReaderDevice::getCaptureFileComment() const } light_pcapng_file_info* fileInfo = light_pcang_get_file_info((light_pcapng_t*)m_LightPcapNg); + if (fileInfo == nullptr) + return ""; char* res = fileInfo->file_comment; size_t len = fileInfo->file_comment_size; if (len == 0 || res == nullptr)