From aae570b4932da15d723b6e7b99038a950fc8a7ad Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Mon, 24 Oct 2011 16:34:10 +0200 Subject: Close fds on pipe() error in tor_spawn_background(). --- changes/bug4296 | 3 +++ src/common/util.c | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 changes/bug4296 diff --git a/changes/bug4296 b/changes/bug4296 new file mode 100644 index 0000000000..c265094ecb --- /dev/null +++ b/changes/bug4296 @@ -0,0 +1,3 @@ + o Minor bugfixes: + - On a failed pipe() call, don't leak fds. Fix for bug 4296; bugfix + on 0.2.3.1-alpha. diff --git a/src/common/util.c b/src/common/util.c index 3950fc1695..1807ee7adc 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -3470,6 +3470,10 @@ tor_spawn_background(const char *const filename, const char **argv, log_warn(LD_GENERAL, "Failed to set up pipe for stderr communication with child process: %s", strerror(errno)); + + close(stdout_pipe[0]); + close(stdout_pipe[1]); + return status; } -- cgit v1.2.3-54-g00ecf