]> git.proxmox.com Git - mirror_lxc.git/commitdiff
coverity: fix fd leak in error case (1011105)
authorDwight Engen <dwight.engen@oracle.com>
Mon, 21 Apr 2014 13:18:06 +0000 (09:18 -0400)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 28 Apr 2014 17:28:33 +0000 (12:28 -0500)
I inadvertently introduced this with commit 8bf1e61e.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/monitor.c

index 4ca4000cd5b90644e1b8c582d348089a4d0d39d1..f356adf2178ab770205375daa2cdcd26a00ab555 100644 (file)
@@ -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)) {