From: Nick Mathewson Date: Tue, 22 Mar 2016 12:29:51 +0000 (-0400) Subject: Fix an fd leak in check_private_dir(). X-Git-Tag: tor-0.2.8.2-alpha~45 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a17537a2386a98cba39c94dfb8b09b50edf16922;p=thirdparty%2Ftor.git Fix an fd leak in check_private_dir(). The fd would leak when the User wasn't recogniezed by getpwnam(). Since we'd then go on to exit, this wasn't a terribad leak, but it's still not as nice as no leak at all. CID 1355640; bugfix on no released Tor. --- diff --git a/src/common/util.c b/src/common/util.c index 39d6502ebf..056817e696 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -2157,6 +2157,7 @@ check_private_dir(const char *dirname, cpd_check_t check, if (pw == NULL) { log_warn(LD_CONFIG, "Error setting configured user: %s not found", effective_user); + close(fd); return -1; } running_uid = pw->pw_uid;