Skip to content

Commit

Permalink
apply memory leak fix for create_and_bind to create_server_socket
Browse files Browse the repository at this point in the history
  • Loading branch information
gdepeyrot authored and Max Lv committed Jul 16, 2021
1 parent a19328a commit 49ead5e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ create_and_bind(const char *host, const char *port, int protocol)
}
}

if (!result) {
if (result != NULL) {
freeaddrinfo(result);
}

Expand Down Expand Up @@ -837,13 +837,15 @@ create_server_socket(const char *host, const char *port)
close(server_sock);
}

if (result != NULL) {
freeaddrinfo(result);
}

if (rp == NULL) {
LOGE("cannot bind");
return -1;
}

freeaddrinfo(result);

return server_sock;
}

Expand Down

0 comments on commit 49ead5e

Please sign in to comment.