[lxc-devel] [lxc/master] Fix mem leak with realpath

keloyang on Github lxc-bot at linuxcontainers.org
Fri Aug 11 09:17:36 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 351 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170811/660d685e/attachment.bin>
-------------- next part --------------
From e58e6e11efeb79d5c1f4e6fed4d2643dfc78f575 Mon Sep 17 00:00:00 2001
From: Shukui Yang <yangshukui at huawei.com>
Date: Fri, 11 Aug 2017 17:12:24 +0800
Subject: [PATCH] Fix mem leak with realpath

Signed-off-by: Shukui Yang <yangshukui at huawei.com>
---
 src/lxc/tools/lxc_start.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/lxc/tools/lxc_start.c b/src/lxc/tools/lxc_start.c
index ef45ffb08..20d5b0364 100644
--- a/src/lxc/tools/lxc_start.c
+++ b/src/lxc/tools/lxc_start.c
@@ -80,16 +80,11 @@ static int ensure_path(char **confpath, const char *path)
 			goto err;
 		}
 
-		*confpath = strdup(fullpath);
-		if (!*confpath) {
-			ERROR("failed to dup string '%s'", fullpath);
-			goto err;
-		}
+		*confpath = fullpath;
 	}
 	err = EXIT_SUCCESS;
 
 err:
-	free(fullpath);
 	return err;
 }
 


More information about the lxc-devel mailing list