This commit is contained in:
2025-01-20 09:46:18 +08:00
parent a3712fde22
commit 5028d24a32

6
cap.c
View File

@@ -188,7 +188,6 @@ void packet_handler(u_char *args, const struct pcap_pkthdr *header, const u_char
const char *REGION_ENV = NULL; const char *REGION_ENV = NULL;
char ipset_query_command[256] = { 0 }; char ipset_query_command[256] = { 0 };
//char ip_query_command[256] = { 0 };
// 定义 Response 结构体 // 定义 Response 结构体
Response 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"); 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_freealldevs(alldevs); // 释放设备列表
//pcap_close(handle); // 关闭会话句柄 //pcap_close(handle); // 关闭会话句柄
// 退出主进程 // 退出主进程
exit(0); exit(0);
return; return;