summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authoryangwei <[email protected]>2023-07-28 23:40:07 +0800
committeryangwei <[email protected]>2023-08-02 18:22:12 +0800
commit44f4cabef1fd40969e6b874c8d99d0acdf79895a (patch)
treea91fc1a4217b7727a13af1e6095e3d73b1b2314d /src/common
parent840c58a1efeed8f5cb7959ac7a110bbf3c2421e7 (diff)
🐞 fix(cmd args mem free): 修复-c参数申请的内存,退出时未释放的bug
Diffstat (limited to 'src/common')
-rw-r--r--src/common/stream_addr_inet.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/common/stream_addr_inet.c b/src/common/stream_addr_inet.c
index 37b4f92..e4c0c05 100644
--- a/src/common/stream_addr_inet.c
+++ b/src/common/stream_addr_inet.c
@@ -1232,11 +1232,11 @@ static int __addr_tcp_n2p_fun(const struct layer_addr *paddr, char *buf, int buf
t4v4 = (const struct stream_tuple4_v4 *)paddr->tuple4_v4;
#if IP_PORT_UNION_VERSION
res = inet_ntop(AF_INET, &t4v4->saddr, ip_src_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
res = inet_ntop(AF_INET, &t4v4->daddr, ip_dst_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
snprintf(buf, buf_len, "%u-%u-%s-%s", ntohs(t4v4->source),ntohs(t4v4->dest), ip_src_str, ip_dst_str);
@@ -1247,11 +1247,11 @@ static int __addr_tcp_n2p_fun(const struct layer_addr *paddr, char *buf, int buf
t4v6 = (const struct stream_tuple4_v6 *)paddr->tuple4_v6;
#if IP_PORT_UNION_VERSION
res = inet_ntop(AF_INET6, t4v6->saddr, ip_src_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
res = inet_ntop(AF_INET6, t4v6->daddr, ip_dst_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
snprintf(buf, buf_len, "%u-%u-%s-%s", ntohs(t4v6->source),ntohs(t4v6->dest), ip_src_str, ip_dst_str);
@@ -1567,11 +1567,11 @@ static int __addr_socks_n2p_fun(const struct layer_addr *paddr, char *buf, int b
t4v4 = (const struct stream_tuple4_v4 *)paddr->tuple4_v4;
#if IP_PORT_UNION_VERSION
res = inet_ntop(AF_INET, &t4v4->saddr, ip_src_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
res = inet_ntop(AF_INET, &t4v4->daddr, ip_dst_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
snprintf(buf, buf_len, "%u-%u-%s-%s", ntohs(t4v4->source),ntohs(t4v4->dest), ip_src_str, ip_dst_str);
@@ -1582,11 +1582,11 @@ static int __addr_socks_n2p_fun(const struct layer_addr *paddr, char *buf, int b
t4v6 = (const struct stream_tuple4_v6 *)paddr->tuple4_v6;
#if IP_PORT_UNION_VERSION
res = inet_ntop(AF_INET6, t4v6->saddr, ip_src_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
res = inet_ntop(AF_INET6, t4v6->daddr, ip_dst_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
snprintf(buf, buf_len, "%u-%u-%s-%s", ntohs(t4v6->source),ntohs(t4v6->dest), ip_src_str, ip_dst_str);
@@ -1614,11 +1614,11 @@ static int __addr_openvpn_n2p_fun(const struct layer_addr *paddr, char *buf, int
t4v4 = (const struct stream_tuple4_v4 *)paddr->tuple4_v4;
#if IP_PORT_UNION_VERSION
res = inet_ntop(AF_INET, &t4v4->saddr, ip_src_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
res = inet_ntop(AF_INET, &t4v4->daddr, ip_dst_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
snprintf(buf, buf_len, "%u-%u-%s-%s", ntohs(t4v4->source),ntohs(t4v4->dest), ip_src_str, ip_dst_str);
@@ -1629,11 +1629,11 @@ static int __addr_openvpn_n2p_fun(const struct layer_addr *paddr, char *buf, int
t4v6 = (const struct stream_tuple4_v6 *)paddr->tuple4_v6;
#if IP_PORT_UNION_VERSION
res = inet_ntop(AF_INET6, t4v6->saddr, ip_src_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
res = inet_ntop(AF_INET6, t4v6->daddr, ip_dst_str, 64);
- if(res <= 0){
+ if(res == 0){
return -1;
}
snprintf(buf, buf_len, "%u-%u-%s-%s", ntohs(t4v6->source),ntohs(t4v6->dest), ip_src_str, ip_dst_str);
@@ -1856,7 +1856,7 @@ const char *stream_addr_list_ntop_inward(const struct streaminfo *pstream)
int ret;
ret = stream_addr_list_ntop_inward_recur(pstream, __stream_list_string[pstream->threadnum]);
- if(ret < 0){
+ if(ret < 1){
return NULL;
}
__stream_list_string[pstream->threadnum][ret-1] = '\0'; /* del last delim ">" */