summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2012-03-10 17:53:20 +0100
committerChristian Beier <dontmind@freeshell.org>2012-03-10 17:53:20 +0100
commitedc75fa4f4f0dbadf7cb21a7511626dd35a3c330 (patch)
tree91db0ef40a93f258759e38933f458d1710d0c442
parentb7e043abad2d3ab7b6e60e6a6c16f6ff25caa0e0 (diff)
downloadlibtdevnc-edc75fa4f4f0dbadf7cb21a7511626dd35a3c330.tar.gz
libtdevnc-edc75fa4f4f0dbadf7cb21a7511626dd35a3c330.zip
IPv6 support for LibVNCServer, part onepointseven: Plug a memleak.
We have to properly free the addrinfo struct when jumping out of the function.
-rw-r--r--libvncserver/sockets.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c
index 3b5ef60..723e769 100644
--- a/libvncserver/sockets.c
+++ b/libvncserver/sockets.c
@@ -893,6 +893,7 @@ rfbListenOnTCP6Port(int port,
if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&one, sizeof(one)) < 0) {
rfbLogPerror("rfbListenOnTCP6Port error in setsockopt IPV6_V6ONLY");
closesocket(sock);
+ freeaddrinfo(servinfo);
return -1;
}
#endif
@@ -900,6 +901,7 @@ rfbListenOnTCP6Port(int port,
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)) < 0) {
rfbLogPerror("rfbListenOnTCP6Port: error in setsockopt SO_REUSEADDR");
closesocket(sock);
+ freeaddrinfo(servinfo);
return -1;
}
@@ -913,6 +915,7 @@ rfbListenOnTCP6Port(int port,
if (p == NULL) {
rfbLogPerror("rfbListenOnTCP6Port: error in bind IPv6 socket");
+ freeaddrinfo(servinfo);
return -1;
}