!172 ldconfig: Fix memory leaks
From: @lvying6 Reviewed-by: @liqingqing_1229 Signed-off-by: @liqingqing_1229
This commit is contained in:
commit
55ed4357c2
75
backport-ldconfig-Fix-memory-leaks.patch
Normal file
75
backport-ldconfig-Fix-memory-leaks.patch
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
From f97b794d7aab9504894b1991f2264dd6914bc24b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||||
|
Date: Tue, 18 May 2021 09:29:02 +0530
|
||||||
|
Subject: [PATCH] ldconfig: Fix memory leaks
|
||||||
|
|
||||||
|
Coverity discovered that paths allocated by chroot_canon are not freed
|
||||||
|
in a couple of routines in ldconfig.
|
||||||
|
|
||||||
|
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
---
|
||||||
|
elf/ldconfig.c | 20 ++++++++++++++------
|
||||||
|
1 file changed, 14 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
|
||||||
|
index fbdd814edf59..be87bb383dac 100644
|
||||||
|
--- a/elf/ldconfig.c
|
||||||
|
+++ b/elf/ldconfig.c
|
||||||
|
@@ -601,16 +601,14 @@ manual_link (char *library)
|
||||||
|
if (lstat64 (real_library, &stat_buf))
|
||||||
|
{
|
||||||
|
error (0, errno, _("Cannot lstat %s"), library);
|
||||||
|
- free (path);
|
||||||
|
- return;
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
/* We don't want links here! */
|
||||||
|
else if (!S_ISREG (stat_buf.st_mode))
|
||||||
|
{
|
||||||
|
error (0, 0, _("Ignored file %s since it is not a regular file."),
|
||||||
|
library);
|
||||||
|
- free (path);
|
||||||
|
- return;
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process_file (real_library, library, libname, &flag, &osversion,
|
||||||
|
@@ -618,14 +616,16 @@ manual_link (char *library)
|
||||||
|
{
|
||||||
|
error (0, 0, _("No link created since soname could not be found for %s"),
|
||||||
|
library);
|
||||||
|
- free (path);
|
||||||
|
- return;
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
if (soname == NULL)
|
||||||
|
soname = implicit_soname (libname, flag);
|
||||||
|
create_links (real_path, path, libname, soname);
|
||||||
|
free (soname);
|
||||||
|
+out:
|
||||||
|
free (path);
|
||||||
|
+ if (path != real_path)
|
||||||
|
+ free (real_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -796,8 +796,16 @@ search_dir (const struct dir_entry *entry)
|
||||||
|
/* Remove stale symlinks. */
|
||||||
|
if (opt_link && strstr (direntry->d_name, ".so."))
|
||||||
|
unlink (real_file_name);
|
||||||
|
+
|
||||||
|
+ if (opt_chroot != NULL)
|
||||||
|
+ free (target_name);
|
||||||
|
+
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ if (opt_chroot != NULL)
|
||||||
|
+ free (target_name);
|
||||||
|
+
|
||||||
|
is_dir = S_ISDIR (stat_buf.st_mode);
|
||||||
|
|
||||||
|
/* lstat_buf is later stored, update contents. */
|
||||||
|
--
|
||||||
|
2.18.4
|
||||||
|
|
||||||
@ -59,7 +59,7 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
Name: glibc
|
Name: glibc
|
||||||
Version: 2.28
|
Version: 2.28
|
||||||
Release: 73
|
Release: 74
|
||||||
Summary: The GNU libc libraries
|
Summary: The GNU libc libraries
|
||||||
License: %{all_license}
|
License: %{all_license}
|
||||||
URL: http://www.gnu.org/software/glibc/
|
URL: http://www.gnu.org/software/glibc/
|
||||||
@ -131,6 +131,7 @@ Patch47: backport-x86-64-Align-child-stack-to-16-bytes-BZ-27902.patch
|
|||||||
Patch48: backport-ldconfig-handle-.dynstr-located-in-separate-segment-.patch
|
Patch48: backport-ldconfig-handle-.dynstr-located-in-separate-segment-.patch
|
||||||
Patch49: backport-CVE-2021-35942-wordexp-handle-overflow-in-positional-parameter-numb.patch
|
Patch49: backport-CVE-2021-35942-wordexp-handle-overflow-in-positional-parameter-numb.patch
|
||||||
Patch50: backport-malloc-Initiate-tcache-shutdown-even-without-allocat.patch
|
Patch50: backport-malloc-Initiate-tcache-shutdown-even-without-allocat.patch
|
||||||
|
Patch51: backport-ldconfig-Fix-memory-leaks.patch
|
||||||
|
|
||||||
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
|
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
|
||||||
|
|
||||||
@ -1155,6 +1156,10 @@ fi
|
|||||||
%doc hesiod/README.hesiod
|
%doc hesiod/README.hesiod
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Jul 31 2021 Lv Ying<lvying6@huawei.com> - 2.28-74
|
||||||
|
- ldconfig: Fix memory leaks
|
||||||
|
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=468d772e81e9842f4f73431c164b4a12f13d8658
|
||||||
|
|
||||||
* Sat Jul 3 2021 Qingqing Li<liqingqing3@huawei.com> - 2.28-73
|
* Sat Jul 3 2021 Qingqing Li<liqingqing3@huawei.com> - 2.28-73
|
||||||
- malloc: tcache shutdown sequence does not work if the thread never allocated anything. (bug 28028)
|
- malloc: tcache shutdown sequence does not work if the thread never allocated anything. (bug 28028)
|
||||||
https://sourceware.org/bugzilla/show_bug.cgi?id=28028
|
https://sourceware.org/bugzilla/show_bug.cgi?id=28028
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user