forked from wolfSSL/wolfssl
fix snifftest pcap frees on file mode, close TraceFile on ssl_Free
This commit is contained in:
@ -417,6 +417,13 @@ void ssl_FreeSniffer(void)
|
|||||||
|
|
||||||
FreeMutex(&SessionMutex);
|
FreeMutex(&SessionMutex);
|
||||||
FreeMutex(&ServerListMutex);
|
FreeMutex(&ServerListMutex);
|
||||||
|
|
||||||
|
if (TraceFile) {
|
||||||
|
TraceOn = 0;
|
||||||
|
fclose(TraceFile);
|
||||||
|
TraceFile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
CyaSSL_Cleanup();
|
CyaSSL_Cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,18 +69,25 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
pcap_t* pcap = 0;
|
pcap_t* pcap = NULL;
|
||||||
pcap_if_t *alldevs;
|
pcap_if_t* alldevs = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
static void FreeAll(void)
|
||||||
|
{
|
||||||
|
if (pcap)
|
||||||
|
pcap_close(pcap);
|
||||||
|
if (alldevs)
|
||||||
|
pcap_freealldevs(alldevs);
|
||||||
|
#ifndef _WIN32
|
||||||
|
ssl_FreeSniffer();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void sig_handler(const int sig)
|
static void sig_handler(const int sig)
|
||||||
{
|
{
|
||||||
printf("SIGINT handled = %d.\n", sig);
|
printf("SIGINT handled = %d.\n", sig);
|
||||||
if (pcap)
|
FreeAll();
|
||||||
pcap_close(pcap);
|
|
||||||
pcap_freealldevs(alldevs);
|
|
||||||
#ifndef _WIN32
|
|
||||||
ssl_FreeSniffer();
|
|
||||||
#endif
|
|
||||||
if (sig)
|
if (sig)
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -286,6 +293,7 @@ int main(int argc, char** argv)
|
|||||||
else if (saveFile)
|
else if (saveFile)
|
||||||
break; /* we're done reading file */
|
break; /* we're done reading file */
|
||||||
}
|
}
|
||||||
|
FreeAll();
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user