The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2327

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Christian Brauner <[email protected]>
From 42cc40833c6a0e3ac01006c4ed35fb73ea958a93 Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Tue, 15 May 2018 12:33:22 +0200
Subject: [PATCH 1/3] coverity: #1435604

Resource leak

Signed-off-by: Christian Brauner <[email protected]>
---
 src/lxc/network.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lxc/network.c b/src/lxc/network.c
index a7e05280d..c77f8c7ce 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -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;

From eb091d0094d430d6d1d2b9ad5260dd41fc0177cc Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Tue, 15 May 2018 12:34:24 +0200
Subject: [PATCH 2/3] coverity: #1435603

Resource leak

Signed-off-by: Christian Brauner <[email protected]>
---
 src/lxc/storage/btrfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lxc/storage/btrfs.c b/src/lxc/storage/btrfs.c
index 955b6a7b2..a9ab7988a 100644
--- a/src/lxc/storage/btrfs.c
+++ b/src/lxc/storage/btrfs.c
@@ -533,6 +533,7 @@ static int btrfs_do_destroy_subvol(const char *path)
        retlen = strlcpy(args.name, p+1, BTRFS_SUBVOL_NAME_MAX);
        if (retlen >= BTRFS_SUBVOL_NAME_MAX) {
                free(newfull);
+               close(fd);
                return -E2BIG;
        }
 

From 4b812aca236191cb86d18108102f750d9cd28c7f Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Tue, 15 May 2018 12:35:34 +0200
Subject: [PATCH 3/3] coverity: #1435602

Resource leak

Signed-off-by: Christian Brauner <[email protected]>
---
 src/lxc/storage/btrfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lxc/storage/btrfs.c b/src/lxc/storage/btrfs.c
index a9ab7988a..be07aeb6f 100644
--- a/src/lxc/storage/btrfs.c
+++ b/src/lxc/storage/btrfs.c
@@ -254,8 +254,11 @@ static int btrfs_subvolume_create(const char *path)
 
        memset(&args, 0, sizeof(args));
        retlen = strlcpy(args.name, p + 1, BTRFS_SUBVOL_NAME_MAX);
-       if (retlen >= BTRFS_SUBVOL_NAME_MAX)
+       if (retlen >= BTRFS_SUBVOL_NAME_MAX) {
+               free(newfull);
+               close(fd);
                return -E2BIG;
+       }
 
        ret = ioctl(fd, BTRFS_IOC_SUBVOL_CREATE, &args);
        saved_errno = errno;
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to