diff --git a/0041-do-not-free-the-pointer-returned-by-dirname.patch b/0041-do-not-free-the-pointer-returned-by-dirname.patch new file mode 100644 index 0000000000000000000000000000000000000000..28e1da533643d2cf7c6b537b5dda75017b948b1b --- /dev/null +++ b/0041-do-not-free-the-pointer-returned-by-dirname.patch @@ -0,0 +1,38 @@ +From 11621ec06e911395c9bb3b5ae5d8f47cfc02ce3e Mon Sep 17 00:00:00 2001 +From: WangFengTu +Date: Thu, 21 Apr 2022 15:59:11 +0800 +Subject: [PATCH] do not free the pointer returned by dirname + +Signed-off-by: WangFengTu +--- + 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 + diff --git a/lxc.spec b/lxc.spec index 1adf41abc3c942826c5f40bbe2b3cd0647f34add..d8504d675e3298fc6aab79b65d29305bd3024971 100644 --- a/lxc.spec +++ b/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) diff --git a/series.conf b/series.conf index 3e14cf0eba7a9b615821d089a1c8c778b796f6a5..7c6011f61f8a46766e2b7f43ef2e48280c24f194 100644 --- a/series.conf +++ b/series.conf @@ -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