]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix an fd leak in check_private_dir().
authorNick Mathewson <nickm@torproject.org>
Tue, 22 Mar 2016 12:29:51 +0000 (08:29 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 22 Mar 2016 12:29:51 +0000 (08:29 -0400)
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.

src/common/util.c

index 39d6502ebf64af6d40643ada9ea16d481d2455a3..056817e6960b758d61ff33a4cb7d9c71acbc1762 100644 (file)
@@ -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;