mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-30 13:13:44 +00:00
apply memory leak fix for create_and_bind to create_server_socket
This commit is contained in:
+5
-3
@@ -442,7 +442,7 @@ create_and_bind(const char *host, const char *port, int protocol)
|
||||
}
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
if (result != NULL) {
|
||||
freeaddrinfo(result);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user