Blame SOURCES/autofs-5.1.0-fix-mem-leak-in-create_client.patch

306fa1
autofs-5.1.0 - fix memory leak in create_client()
306fa1
306fa1
From: Ian Kent <raven@themaw.net>
306fa1
306fa1
In create_client(), if the target host is unreachable the function
306fa1
exists without freeing the addrinfo data returned from getaddrinfo(3).
306fa1
---
306fa1
 CHANGELOG      |    1 +
306fa1
 lib/rpc_subs.c |    4 +++-
306fa1
 2 files changed, 4 insertions(+), 1 deletion(-)
306fa1
306fa1
--- autofs-5.0.7.orig/CHANGELOG
306fa1
+++ autofs-5.0.7/CHANGELOG
306fa1
@@ -148,6 +148,7 @@
306fa1
 - add mutex call return check in defaults.c.
306fa1
 - force disable browse mode for amd format maps.
306fa1
 - fix hosts map options check in lookup_amd_instance().
306fa1
+- fix memory leak in create_client().
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
--- autofs-5.0.7.orig/lib/rpc_subs.c
306fa1
+++ autofs-5.0.7/lib/rpc_subs.c
306fa1
@@ -719,8 +719,10 @@ static int create_client(struct conn_inf
306fa1
 		ret = rpc_do_create_client(haddr->ai_addr, info, &fd, client);
306fa1
 		if (ret == 0)
306fa1
 			break;
306fa1
-		if (ret == -EHOSTUNREACH)
306fa1
+		if (ret == -EHOSTUNREACH) {
306fa1
+			freeaddrinfo(ai);
306fa1
 			goto out_close;
306fa1
+		}
306fa1
 
306fa1
 		if (!info->client && fd != RPC_ANYSOCK) {
306fa1
 			close(fd);