修复内存泄漏

This commit is contained in:
aixiao 2024-07-05 09:25:44 +08:00
parent 0b5e40d5c4
commit d8f7c47faa
3 changed files with 8 additions and 1 deletions

View File

@ -35,6 +35,7 @@ Centos 7
yum install clamav clamav-update clamav-lib clamav-devel json-c-devel pcre2-devel yum install clamav clamav-update clamav-lib clamav-devel json-c-devel pcre2-devel
yum install iptables-devel libcurl-devel yum install iptables-devel libcurl-devel
yum install systemd-devel libtool-ltdl-devel libmspack-devel yum install systemd-devel libtool-ltdl-devel libmspack-devel
yum install cmake3
yum -y install centos-release-scl yum -y install centos-release-scl
yum -y install devtoolset-11-gcc yum -y install devtoolset-11-gcc

View File

@ -58,10 +58,14 @@ static int Handle_IP(char *string, conf *config)
//printf(RED "%s Nginx Ip Address: %s, 属于地域白名单: %s\n" COLOR_NONE, t, IP, area); //printf(RED "%s Nginx Ip Address: %s, 属于地域白名单: %s\n" COLOR_NONE, t, IP, area);
} else { } else {
my_printf(RED "%s Nginx 封禁 Ip Address: %s, 地址: %s!!!\n" COLOR_NONE, t, IP, area); my_printf(RED "%s Nginx 封禁 Ip Address: %s, 地址: %s!!!\n" COLOR_NONE, t, IP, area);
nginx_iptc(IP); nginx_iptc(IP);
} }
} }
if (t)
free(t);
return 0; return 0;
} }

4
rule.c
View File

@ -33,7 +33,6 @@ static int Handle_IP(conf *conf, char *ip)
if (conf->REGION == 1) { if (conf->REGION == 1) {
if (conf->IP2REGION == 1) { if (conf->IP2REGION == 1) {
//printf("%s Use ip2region !!!\n", t);
if (access(xdb_path, F_OK) == -1) { if (access(xdb_path, F_OK) == -1) {
xdb_path = "ip2region/ip2region.xdb"; xdb_path = "ip2region/ip2region.xdb";
@ -67,6 +66,9 @@ BLOCKED:
if (area != NULL) { if (area != NULL) {
free(area); free(area);
} }
if (t)
free(t);
} }
return 0; return 0;