]> git.proxmox.com Git - mirror_lxc.git/commitdiff
coverity: #1435604
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 15 May 2018 10:33:22 +0000 (12:33 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 15 May 2018 10:39:28 +0000 (12:39 +0200)
Resource leak

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/network.c

index a7e05280dc1385b66f103b24ed4d4ce3a58a47d3..c77f8c7ce47e83470cfa571d72c367096c1ee7a8 100644 (file)
@@ -1916,8 +1916,10 @@ int lxc_bridge_attach(const char *bridge, const char *ifname)
                return -errno;
 
        retlen = strlcpy(ifr.ifr_name, bridge, IFNAMSIZ);
-       if (retlen >= IFNAMSIZ)
+       if (retlen >= IFNAMSIZ) {
+               close(fd);
                return -E2BIG;
+       }
 
        ifr.ifr_name[IFNAMSIZ - 1] = '\0';
        ifr.ifr_ifindex = index;