fix memory leak in ares_getnameinfo
authorAndrew C. Morrow <andrew.c.morrow@gmail.com>
Wed, 16 Jun 2010 02:18:24 +0000 (10:18 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 16 Jun 2010 07:44:19 +0000 (15:44 +0800)
ares_getnameinfo.c

index fc4b7fa..8ae2f02 100644 (file)
@@ -243,6 +243,7 @@ static void nameinfo_callback(void *arg, int status, int timeouts,
       niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts,
                         (char *)(host->h_name),
                         service);
+      free(niquery);
       return;
     }
   /* We couldn't find the host, but it's OK, we can use the IP */
@@ -273,6 +274,7 @@ static void nameinfo_callback(void *arg, int status, int timeouts,
         }
       niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, ipbuf,
                         service);
+      free(niquery);
       return;
     }
   niquery->callback(niquery->arg, status, niquery->timeouts, NULL, NULL);