[tor-commits] [tor/master] Close fds on pipe() error in tor_spawn_background().

nickm at torproject.org nickm at torproject.org
Mon Mar 12 16:37:40 UTC 2012


commit aae570b4932da15d723b6e7b99038a950fc8a7ad
Author: George Kadianakis <desnacked at gmail.com>
Date:   Mon Oct 24 16:34:10 2011 +0200

    Close fds on pipe() error in tor_spawn_background().
---
 changes/bug4296   |    3 +++
 src/common/util.c |    4 ++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/changes/bug4296 b/changes/bug4296
new file mode 100644
index 0000000..c265094
--- /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 3950fc1..1807ee7 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;
   }
 



More information about the tor-commits mailing list