[lxc-devel] [PATCH] coverity: fix fd leak in error case (1011105)
Dwight Engen
dwight.engen at oracle.com
Mon Apr 21 13:18:06 UTC 2014
I inadvertently introduced this with commit 8bf1e61e.
Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
src/lxc/monitor.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/lxc/monitor.c b/src/lxc/monitor.c
index 4ca4000..f356adf 100644
--- a/src/lxc/monitor.c
+++ b/src/lxc/monitor.c
@@ -106,8 +106,10 @@ static void lxc_monitor_fifo_send(struct lxc_msg *msg, const char *lxcpath)
return;
}
- if (fcntl(fd, F_SETFL, O_WRONLY) < 0)
+ if (fcntl(fd, F_SETFL, O_WRONLY) < 0) {
+ close(fd);
return;
+ }
ret = write(fd, msg, sizeof(*msg));
if (ret != sizeof(*msg)) {
--
1.9.0
More information about the lxc-devel
mailing list