]> granicus.if.org Git - curl/commitdiff
tests: fix memleak in server/resolve.c
authorPeter Wu <peter@lekensteyn.nl>
Thu, 6 Nov 2014 00:32:41 +0000 (01:32 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 10 Nov 2014 08:06:48 +0000 (09:06 +0100)
This makes LeakSanitizer happy.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
tests/server/resolve.c

index d0609888a42e2ae6e103712cb5f8319d234e5d5d..b84e7fd260700890fb5abff6e6f3a423e0f770eb 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -135,9 +135,11 @@ int main(int argc, char *argv[])
       hints.ai_family = PF_INET6;
       hints.ai_socktype = SOCK_STREAM;
       hints.ai_flags = AI_CANONNAME;
-      /* Use parenthesis around function to stop it from being replaced by
-      the macro in memdebug.h */
+      /* Use parenthesis around functions to stop them from being replaced by
+         the macro in memdebug.h */
       rc = (getaddrinfo)(host, "80", &hints, &ai);
+      if (rc == 0)
+        (freeaddrinfo)(ai);
     }
 
 #else