aboutsummaryrefslogtreecommitdiff
path: root/src/common/log.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-12-28 22:49:32 -0500
committerNick Mathewson <nickm@torproject.org>2012-12-28 22:49:32 -0500
commitd3aabf4db176a44d19046b58b99f2edb8c5f49bb (patch)
treed804e239d5e0c4993c82f40cb97b25a1f7f73132 /src/common/log.c
parentb509ead20d93277697c1cb961a2ae520bce7fd7f (diff)
downloadtor-d3aabf4db176a44d19046b58b99f2edb8c5f49bb.tar
tor-d3aabf4db176a44d19046b58b99f2edb8c5f49bb.tar.gz
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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/log.c b/src/common/log.c
index 5e2e6b5b5..5f0b4f8d9 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);