Browse Source

Close fds on pipe() error in tor_spawn_background().

George Kadianakis 12 years ago
parent
commit
aae570b493
2 changed files with 7 additions and 0 deletions
  1. 3 0
      changes/bug4296
  2. 4 0
      src/common/util.c

+ 3 - 0
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.

+ 4 - 0
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;
   }