[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [torsocks/master] Test: fix memory leak in DNS test



commit 8cb73844e7ab74302fdcb289e679beab3de34ce0
Author: David Goulet <dgoulet@xxxxxxxxx>
Date:   Wed Oct 1 16:19:40 2014 -0400

    Test: fix memory leak in DNS test
    
    Fix Coverity issue 1243012.
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxx>
---
 tests/test_dns.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/test_dns.c b/tests/test_dns.c
index 58c7675..7d592ac 100644
--- a/tests/test_dns.c
+++ b/tests/test_dns.c
@@ -18,6 +18,7 @@
 #include <arpa/inet.h>
 #include <netinet/in.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/socket.h>
 
 #include <lib/torsocks.h>
@@ -100,7 +101,7 @@ static void test_getaddrinfo(const struct test_host *host)
 {
 	int ret;
     struct addrinfo hints;
-    struct addrinfo *result;
+    struct addrinfo *result = NULL;
 
 	diag("getaddrinfo test");
 
@@ -128,6 +129,7 @@ static void test_getaddrinfo(const struct test_host *host)
 		fail("Resolving address %s with getaddrinfo", host->name);
 	}
 
+	free(result);
     return;
 }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits