fix the memory leak in new_TCP_server function

This commit is contained in:
slaniCode 2014-08-27 02:00:52 +02:00
parent 12cada5bdb
commit f1ed0eeabb

View File

@ -953,6 +953,7 @@ TCP_Server *new_TCP_server(uint8_t ipv6_enabled, uint16_t num_sockets, const uin
temp->efd = epoll_create(8); temp->efd = epoll_create(8);
if (temp->efd == -1) { if (temp->efd == -1) {
free(temp->socks_listening);
free(temp); free(temp);
return NULL; return NULL;
} }
@ -992,7 +993,8 @@ TCP_Server *new_TCP_server(uint8_t ipv6_enabled, uint16_t num_sockets, const uin
} }
if (temp->num_listening_socks == 0) { if (temp->num_listening_socks == 0) {
free(temp); free(temp->socks_listening);
free(temp);
return NULL; return NULL;
} }