Browse files

Dont leak addrinfo in error path

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

0 comments on commit be7f593

Please sign in to comment.