do not free the pointer returned by dirname
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
This commit is contained in:
parent
a07b7ab5b3
commit
d8ee6459cc
38
0041-do-not-free-the-pointer-returned-by-dirname.patch
Normal file
38
0041-do-not-free-the-pointer-returned-by-dirname.patch
Normal file
@ -0,0 +1,38 @@
|
||||
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
|
||||
|
||||
1
lxc.spec
1
lxc.spec
@ -48,6 +48,7 @@ Patch0037: 0037-fix-always-print-and-temp-len.patch
|
||||
Patch0038: 0038-just-print-error-when-new-lock-failed.patch
|
||||
Patch0039: 0039-fix-bug-of-memory-free.patch
|
||||
Patch0040: 0040-refactor-the-way-to-convert-selinux-label-to-shared.path
|
||||
Patch0041: 0041-do-not-free-the-pointer-returned-by-dirname.patch
|
||||
|
||||
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
|
||||
BuildRequires: pkgconfig(libseccomp)
|
||||
|
||||
@ -38,3 +38,4 @@
|
||||
0038-just-print-error-when-new-lock-failed.patch
|
||||
0039-fix-bug-of-memory-free.patch
|
||||
0040-refactor-the-way-to-convert-selinux-label-to-shared.path
|
||||
0041-do-not-free-the-pointer-returned-by-dirname.patch
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user