aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-03-22 08:29:51 -0400
committerNick Mathewson <nickm@torproject.org>2016-03-22 08:29:51 -0400
commita17537a2386a98cba39c94dfb8b09b50edf16922 (patch)
treef259bd8daf359bf426f592dd6b9defd01de1d2a5
parent580e549f75e43a1452f982949977f67691cc1a5a (diff)
downloadtor-a17537a2386a98cba39c94dfb8b09b50edf16922.tar.gz
tor-a17537a2386a98cba39c94dfb8b09b50edf16922.zip
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.
-rw-r--r--src/common/util.c1
1 files changed, 1 insertions, 0 deletions
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;