From: Ronnie Sahlberg Date: Fri, 16 Nov 2012 02:38:54 +0000 (+1100) Subject: Dont leak addrinfo in error path X-Git-Tag: upstream/1.9.6^2~242^2~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2811861b9634ebc30b3c56afe681f1d3eb0e5060;p=deb_libnfs.git Dont leak addrinfo in error path --- diff --git a/lib/socket.c b/lib/socket.c index 3fa8378..32c0945 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -598,6 +598,7 @@ int rpc_set_udp_destination(struct rpc_context *rpc, char *addr, int port, int i rpc->udp_dest = malloc(ai->ai_addrlen); if (rpc->udp_dest == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate sockaddr structure"); + freeaddrinfo(ai); return -1; } memcpy(rpc->udp_dest, ai->ai_addr, ai->ai_addrlen);