[2633] in BarnOwl Developers
[PATCH] Don't leak an owl_popexec if fork or pipe fail
daemon@ATHENA.MIT.EDU (David Benjamin)
Sat Sep 18 02:44:13 2010
From: David Benjamin <davidben@MIT.EDU>
To: barnowl-dev@mit.edu
Date: Fri, 17 Sep 2010 23:43:59 -0700
---
popexec.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/popexec.c b/popexec.c
index 53b25aa..ab01920 100644
--- a/popexec.c
+++ b/popexec.c
@@ -33,6 +33,7 @@ owl_popexec *owl_popexec_new(const char *command)
if (0 != pipe(pipefds)) {
owl_function_error("owl_function_popless_exec: pipe failed\n");
+ owl_popexec_unref(pe);
return NULL;
}
parent_read_fd = pipefds[0];
@@ -42,6 +43,7 @@ owl_popexec *owl_popexec_new(const char *command)
close(pipefds[0]);
close(pipefds[1]);
owl_function_error("owl_function_popless_exec: fork failed\n");
+ owl_popexec_unref(pe);
return NULL;
} else if (pid != 0) {
close(child_write_fd);
--
1.7.2.1.45.gb1c4