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~250 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=be7f59339ee92ae6ebc37ceb170a0287b99b71ae;p=deb_libnfs.git Dont leak addrinfo in error path --- diff --git a/lib/socket.c b/lib/socket.c index 1bb34f0..8ad5e4e 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -599,6 +599,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);