diff --git a/src/manager.c b/src/manager.c index bcbcbdc7..fe505127 100644 --- a/src/manager.c +++ b/src/manager.c @@ -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; }