projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
df94327
)
Memleak: getaddrinfo needs freeadrinfo here too.
author
Wilfried Goesgens
<dothebart@citadel.org>
Sun, 28 Nov 2010 20:02:00 +0000
(21:02 +0100)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Sun, 28 Nov 2010 20:02:00 +0000
(21:02 +0100)
webcit/tcp_sockets.c
patch
|
blob
|
history
diff --git
a/webcit/tcp_sockets.c
b/webcit/tcp_sockets.c
index 99173ea518771aef130267864d561639112ec5d6..2ee3cb27e0b81e0289c766cdc70eadf97d1797a3 100644
(file)
--- a/
webcit/tcp_sockets.c
+++ b/
webcit/tcp_sockets.c
@@
-110,6
+110,7
@@
int tcp_connectsock(char *host, char *service)
rc = getaddrinfo(host, service, &hints, &res);
if (rc != 0) {
lprintf(1, "%s: %s\n", host, gai_strerror(rc));
+ freeaddrinfo(res);
return(-1);
}
@@
-125,10
+126,12
@@
int tcp_connectsock(char *host, char *service)
s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (s < 0) {
lprintf(1, "socket() failed: %s\n", strerror(errno));
+ freeaddrinfo(res);
return(-1);
}
rc = connect(s, ai->ai_addr, ai->ai_addrlen);
if (rc >= 0) {
+ freeaddrinfo(res);
return(s);
}
else {
@@
-136,7
+139,7
@@
int tcp_connectsock(char *host, char *service)
close(s);
}
}
-
+ freeaddrinfo(res);
return(-1);
}