From: Alan T. DeKok Date: Thu, 6 Sep 2012 09:18:15 +0000 (+0200) Subject: Close socket on error. Bug found by Coverity X-Git-Tag: release_3_0_0_beta0~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35b53c2fa2f6761f3e48eb1863f660f4039600c7;p=thirdparty%2Ffreeradius-server.git Close socket on error. Bug found by Coverity --- diff --git a/src/main/command.c b/src/main/command.c index 0a061517cb6..bd702a5b71f 100644 --- a/src/main/command.c +++ b/src/main/command.c @@ -183,6 +183,7 @@ static int fr_server_domain_socket(const char *path) if (errno != ENOENT) { radlog(L_ERR, "Failed to stat %s: %s", path, strerror(errno)); + close(sockfd); return -1; } @@ -196,6 +197,7 @@ static int fr_server_domain_socket(const char *path) #endif ) { radlog(L_ERR, "Cannot turn %s into socket", path); + close(sockfd); return -1; } @@ -204,12 +206,14 @@ static int fr_server_domain_socket(const char *path) */ if (buf.st_uid != geteuid()) { radlog(L_ERR, "We do not own %s", path); + close(sockfd); return -1; } if (unlink(path) < 0) { radlog(L_ERR, "Failed to delete %s: %s", path, strerror(errno)); + close(sockfd); return -1; } }