changeset 122:452adc41ccf5

Remember to free the connection data buffer.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 22 Jun 2014 02:45:06 +0300
parents 8c39e8e90dbd
children c8584cf52c98
files th_network.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/th_network.c	Sun Jun 22 02:12:17 2014 +0300
+++ b/th_network.c	Sun Jun 22 02:45:06 2014 +0300
@@ -123,9 +123,11 @@
     if (conn == NULL)
         return NULL;
 
+    // Set function pointers
     conn->errfunc = errfunc;
     conn->msgfunc = msgfunc;
 
+    // Allocate connection data buffer
     conn->bufsize = (bufsize <= 0) ? TH_CONNBUF_SIZE : bufsize;
     if ((conn->buf = th_malloc(conn->bufsize)) == NULL)
     {
@@ -678,6 +680,7 @@
 
 static void th_conn_free_nodelete(th_conn_t *conn)
 {
+    th_free(conn->buf);
     th_conn_close(conn);
     th_free(conn->host);
     th_free(conn->proxy.host);