apply memory leak fix for create_and_bind to create_server_socket

This commit is contained in:
Gilles Depeyrot
2021-07-16 09:36:07 +08:00
committed by Max Lv
parent a19328a977
commit 49ead5e570
+5 -3
View File
@@ -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;
}