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

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: 0x0916 <[email protected]>
From 17ac53014ba7bfa26e84096abd3b179d1752b18b Mon Sep 17 00:00:00 2001
From: 0x0916 <[email protected]>
Date: Fri, 23 Jun 2017 20:36:56 +0800
Subject: [PATCH] fix memory and resource leak

Signed-off-by: 0x0916 <[email protected]>
---
 src/lxc/attach.c    | 1 +
 src/lxc/bdev/bdev.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lxc/attach.c b/src/lxc/attach.c
index eae494067..7cfca4342 100644
--- a/src/lxc/attach.c
+++ b/src/lxc/attach.c
@@ -207,6 +207,7 @@ static struct lxc_proc_context_info 
*lxc_proc_get_context_info(pid_t pid)
        info = calloc(1, sizeof(*info));
        if (!info) {
                SYSERROR("Could not allocate memory.");
+               fclose(proc_file);
                return NULL;
        }
 
diff --git a/src/lxc/bdev/bdev.c b/src/lxc/bdev/bdev.c
index 91eb42a0a..44c4e0423 100644
--- a/src/lxc/bdev/bdev.c
+++ b/src/lxc/bdev/bdev.c
@@ -754,8 +754,10 @@ int do_mkfs_exec_wrapper(void *args)
                return -1;
 
        ret = snprintf(mkfs, len, "mkfs.%s", data[0]);
-       if (ret < 0 || (size_t)ret >= len)
+       if (ret < 0 || (size_t)ret >= len) {
+               free(mkfs);
                return -1;
+       }
 
        TRACE("executing \"%s %s\"", mkfs, data[1]);
        execlp(mkfs, mkfs, data[1], (char *)NULL);
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to