Skip to content

Commit

Permalink
Merge pull request #200 from jow-/socket-leak-fix
Browse files Browse the repository at this point in the history
socket: fix potential memory leak in connect()
  • Loading branch information
jow- authored May 14, 2024
2 parents 0d823e7 + 8cf816d commit ecc6947
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -2228,8 +2228,11 @@ uc_socket_connect(uc_vm_t *vm, size_t nargs)
uc_vector_grow(&addresses);
ap = &addresses.entries[addresses.count++];

if (!uv_to_sockaddr(host, &ap->ss, &ap->ai.ai_addrlen))
if (!uv_to_sockaddr(host, &ap->ss, &ap->ai.ai_addrlen)) {
free(ai_hints);
uc_vector_clear(&addresses);
return NULL;
}

if (serv) {
uint64_t port = ucv_to_unsigned(serv);
Expand Down

0 comments on commit ecc6947

Please sign in to comment.