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

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) ===
Resource leak

Signed-off-by: Donghwa Jeong <[email protected]>
From db8b325a3cacc5e213d37deda72c49460e9ca8a2 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <[email protected]>
Date: Thu, 14 Jun 2018 10:36:46 +0900
Subject: [PATCH] coverity: #1436916

Resource leak

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

diff --git a/src/lxc/tools/lxc_unshare.c b/src/lxc/tools/lxc_unshare.c
index eb69068af..699823bff 100644
--- a/src/lxc/tools/lxc_unshare.c
+++ b/src/lxc/tools/lxc_unshare.c
@@ -101,8 +101,10 @@ static bool lookup_user(const char *optarg, uid_t *uid)
 
        if (sscanf(optarg, "%u", uid) < 1) {
                /* not a uid -- perhaps a username */
-               if (sscanf(optarg, "%s", name) < 1)
+               if (sscanf(optarg, "%s", name) < 1) {
+                       free(buf);
                        return false;
+               }
 
                ret = getpwnam_r(name, &pwent, buf, bufsize, &pwentp);
                if (!pwentp) {
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to