39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
From 11621ec06e911395c9bb3b5ae5d8f47cfc02ce3e Mon Sep 17 00:00:00 2001
|
|
From: WangFengTu <wangfengtu@huawei.com>
|
|
Date: Thu, 21 Apr 2022 15:59:11 +0800
|
|
Subject: [PATCH] do not free the pointer returned by dirname
|
|
|
|
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
|
---
|
|
src/lxc/conf.c | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
|
|
index 7c2619c..cd9e818 100644
|
|
--- a/src/lxc/conf.c
|
|
+++ b/src/lxc/conf.c
|
|
@@ -4258,6 +4258,7 @@ static int setup_populate_devs(const struct lxc_rootfs *rootfs, struct lxc_list
|
|
INFO("Populating devices into container");
|
|
cur_mask = umask(0000);
|
|
lxc_list_for_each(it, devs) {
|
|
+ __do_free char *tmp_path = NULL;
|
|
ret = 0;
|
|
dev_elem = it->elem;
|
|
|
|
@@ -4268,10 +4269,9 @@ static int setup_populate_devs(const struct lxc_rootfs *rootfs, struct lxc_list
|
|
}
|
|
|
|
/* create any missing directories */
|
|
- pathdirname = safe_strdup(path);
|
|
- pathdirname = dirname(pathdirname);
|
|
+ tmp_path = safe_strdup(path);
|
|
+ pathdirname = dirname(tmp_path);
|
|
ret = mkdir_p(pathdirname, 0755);
|
|
- free(pathdirname);
|
|
if (ret < 0) {
|
|
WARN("Failed to create target directory");
|
|
ret = -1;
|
|
--
|
|
2.25.1
|
|
|