c-ares/0001-fix-memory-leak-in-are...

33 lines
1.1 KiB
Diff

From d6b869894190e15960987786d337dc8d42f8285b Mon Sep 17 00:00:00 2001
From: Andrew C. Morrow <andrew.c.morrow@gmail.com>
Date: Wed, 16 Jun 2010 10:18:24 +0800
Subject: [PATCH] fix memory leak in ares_getnameinfo
---
ares_getnameinfo.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/ares_getnameinfo.c b/ares_getnameinfo.c
index fc4b7fa..8ae2f02 100644
--- a/ares_getnameinfo.c
+++ b/ares_getnameinfo.c
@@ -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);
--
1.7.2.1