diff --git a/src/brain.c b/src/brain.c index fbb1f206a..88b896c55 100644 --- a/src/brain.c +++ b/src/brain.c @@ -3052,6 +3052,8 @@ int brain_server (const char *listen_host, const int listen_port, const char *br { brain_logging (stderr, 0, "setsockopt: %s\n", strerror (errno)); + close(server_fd); + if (brain_password == NULL) hcfree (auth_password); return -1; @@ -3061,6 +3063,8 @@ int brain_server (const char *listen_host, const int listen_port, const char *br { brain_logging (stderr, 0, "setsockopt: %s\n", strerror (errno)); + close(server_fd); + if (brain_password == NULL) hcfree (auth_password); return -1; @@ -3104,6 +3108,8 @@ int brain_server (const char *listen_host, const int listen_port, const char *br { brain_logging (stderr, 0, "%s: %s\n", listen_host, gai_strerror (rc_getaddrinfo)); + close(server_fd); + if (brain_password == NULL) hcfree (auth_password); return -1; @@ -3114,6 +3120,8 @@ int brain_server (const char *listen_host, const int listen_port, const char *br { brain_logging (stderr, 0, "bind: %s\n", strerror (errno)); + close(server_fd); + if (brain_password == NULL) hcfree (auth_password); return -1; @@ -3123,6 +3131,8 @@ int brain_server (const char *listen_host, const int listen_port, const char *br { brain_logging (stderr, 0, "listen: %s\n", strerror (errno)); + close(server_fd); + if (brain_password == NULL) hcfree (auth_password); return -1;