Skip to content

Commit 46647be

Browse files
ordexrofl0r
authored andcommitted
fix memory leak
don't leak variable 'space' when the host is numeric Signed-off-by: Antonio Quartulli <[email protected]>
1 parent bb3df1e commit 46647be

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,10 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
830830
if(node && !inet_aton(node, &((struct sockaddr_in *) &space->sockaddr_space)->sin_addr)) {
831831
/* some folks (nmap) use getaddrinfo() with AI_NUMERICHOST to check whether a string
832832
containing a numeric ip was passed. we must return failure in that case. */
833-
if(hints && (hints->ai_flags & AI_NUMERICHOST)) return EAI_NONAME;
833+
if(hints && (hints->ai_flags & AI_NUMERICHOST)) {
834+
free(space);
835+
return EAI_NONAME;
836+
}
834837
hp = proxy_gethostbyname(node, &ghdata);
835838
if(hp)
836839
memcpy(&((struct sockaddr_in *) &space->sockaddr_space)->sin_addr,

0 commit comments

Comments
 (0)