cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH 1/8] tests: fix memleak in server/resolve.c

From: Peter Wu <peter_at_lekensteyn.nl>
Date: Thu, 6 Nov 2014 01:32:41 +0100

This makes LeakSanitizer happy.

Signed-off-by: Peter Wu <peter_at_lekensteyn.nl>

---
 tests/server/resolve.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/tests/server/resolve.c b/tests/server/resolve.c
index d060988..b9f30ab 100644
--- a/tests/server/resolve.c
+++ b/tests/server/resolve.c
@@ -138,6 +138,8 @@ int main(int argc, char *argv[])
       /* Use parenthesis around function to stop it from being replaced by
       the macro in memdebug.h */
       rc = (getaddrinfo)(host, "80", &hints, &ai);
+      if (rc == 0)
+        freeaddrinfo(ai);
     }
 
 #else
-- 
2.1.2
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-11-06