From: Dwight Engen Date: Mon, 21 Apr 2014 13:18:06 +0000 (-0400) Subject: coverity: fix fd leak in error case (1011105) X-Git-Tag: lxc-1.1.0.alpha1~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92ffb6d8acb1ecb08eb86ca19fbaf5576284f779;p=thirdparty%2Flxc.git coverity: fix fd leak in error case (1011105) I inadvertently introduced this with commit 8bf1e61e. Signed-off-by: Dwight Engen Signed-off-by: Serge Hallyn --- diff --git a/src/lxc/monitor.c b/src/lxc/monitor.c index 4ca4000cd..f356adf21 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)) {