]> git.ipfire.org Git - thirdparty/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>
Mon, 10 Dec 2018 07:20:17 +0000 (08:20 +0100)
Resource leak

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

index 445127987395f9534e5006469ea62b91a08ca6ea..889615af3332219de02ced0bcd24306c95aff401 100644 (file)
@@ -1838,8 +1838,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_ifindex = index;
        err = ioctl(fd, SIOCBRADDIF, &ifr);