Memory leak in tcpip_connect_nb_to_server_with_port

Roman Shterenzon <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
It looks like it leaks the IP string every time.

Please review the proposed fix.

--Roman
socket.patch (application/octet-stream, 496 B)
diff --git a/gwlib/socket.c b/gwlib/socket.c
index ea96e82..a76de3d 100644
--- a/gwlib/socket.c
+++ b/gwlib/socket.c
@@ -314,6 +314,7 @@ int tcpip_connect_nb_to_server_with_port(char *hostname, int port, int our_port,
                 error(errno, "nonblocking connect to <%s> failed", octstr_get_cstr(ip2));
             }
         }
+        octstr_destroy(ip2);
     } while (rc == -1 && errno != EINPROGRESS && hostinfo.h_addr_list[++i] != NULL);
 
     if (rc == -1 && errno != EINPROGRESS)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.