Permalink
Browse files

Dont leak addrinfo in error path

  • Loading branch information...
1 parent a3b77e1 commit 2811861b9634ebc30b3c56afe681f1d3eb0e5060 @sahlberg committed Nov 16, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/socket.c
View
@@ -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);

0 comments on commit 2811861

Please sign in to comment.