autofs-5.0.9 - fix memory leak in create_client()

From: Ian Kent <raven@themaw.net>

In create_client(), if the target host is unreachable the function
exists without freeing the addrinfo data returned from getaddrinfo(3).
---
 CHANGELOG      |    1 +
 lib/rpc_subs.c |    4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 943032c..38dcd1a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,7 @@
 - dont allocate dev_ctl_ops too early.
 - fix race accessing qdn in get_query_dn().
 - fix incorrect round robin host detection.
+- fix memory leak in create_client().
 
 28/03/2014 autofs-5.0.9
 =======================
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
index 5d6ead0..846c40e 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -720,8 +720,10 @@ static int create_client(struct conn_info *info, CLIENT **client)
 		ret = rpc_do_create_client(haddr->ai_addr, info, &fd, client);
 		if (ret == 0)
 			break;
-		if (ret == -EHOSTUNREACH)
+		if (ret == -EHOSTUNREACH) {
+			freeaddrinfo(ai);
 			goto out_close;
+		}
 
 		if (!info->client && fd != RPC_ANYSOCK) {
 			close(fd);
