From 5028d24a32ab1a3aa31ae56fad40c3fceb09d2ba Mon Sep 17 00:00:00 2001 From: aixiao Date: Mon, 20 Jan 2025 09:46:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cap.c b/cap.c index 9c96a9c..dae9447 100644 --- a/cap.c +++ b/cap.c @@ -188,7 +188,6 @@ void packet_handler(u_char *args, const struct pcap_pkthdr *header, const u_char const char *REGION_ENV = NULL; char ipset_query_command[256] = { 0 }; - //char ip_query_command[256] = { 0 }; // 定义 Response 结构体 Response response; @@ -271,7 +270,8 @@ void packet_handler(u_char *args, const struct pcap_pkthdr *header, const u_char fprintf(stderr, "Failed to parse JSON.\n"); } - free(p); + if (p != NULL) + free(p); } @@ -334,7 +334,7 @@ void cleanup_(int signum) pcap_freealldevs(alldevs); // 释放设备列表 //pcap_close(handle); // 关闭会话句柄 - // 退出主进程 + // 退出主进程 exit(0); return;