diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-12-28 22:49:32 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-12-28 22:49:32 -0500 |
commit | d3aabf4db176a44d19046b58b99f2edb8c5f49bb (patch) | |
tree | d804e239d5e0c4993c82f40cb97b25a1f7f73132 /src/common/log.c | |
parent | b509ead20d93277697c1cb961a2ae520bce7fd7f (diff) | |
download | tor-d3aabf4db176a44d19046b58b99f2edb8c5f49bb.tar.gz tor-d3aabf4db176a44d19046b58b99f2edb8c5f49bb.zip |
Fix various small leaks on error cases
Spotted by coverity, bug 7816, bugfix on various versions.
Diffstat (limited to 'src/common/log.c')
-rw-r--r-- | src/common/log.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/log.c b/src/common/log.c index 5e2e6b5b50..5f0b4f8d9c 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -833,8 +833,10 @@ add_file_log(const log_severity_list_t *severity, const char *filename) fd = tor_open_cloexec(filename, O_WRONLY|O_CREAT|O_APPEND, 0644); if (fd<0) return -1; - if (tor_fd_seekend(fd)<0) + if (tor_fd_seekend(fd)<0) { + close(fd); return -1; + } LOCK_LOGS(); add_stream_log_impl(severity, filename, fd); |