From 3efc870bc73b9dd0489cd3a1fc5cf592407d7059 Mon Sep 17 00:00:00 2001 From: wangchen2020 <15955488707@163.com> Date: Fri, 15 May 2020 11:36:27 +0800 Subject: [PATCH] fix memory leak in bfd_check_format() --- bfd_check_format-memory-leak.patch | 27 +++++++++++++++++++++++++++ binutils.spec | 9 ++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 bfd_check_format-memory-leak.patch diff --git a/bfd_check_format-memory-leak.patch b/bfd_check_format-memory-leak.patch new file mode 100644 index 0000000..917b84e --- /dev/null +++ b/bfd_check_format-memory-leak.patch @@ -0,0 +1,27 @@ +From 9d78076ef8ef07890ad89c1122bdf49932a979a5 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Fri, 20 Dec 2019 10:03:30 +1030 +Subject: [PATCH] bfd_check_format memory leak + + * format.c (bfd_check_format_matches): Free matching_vector when + not returning matching target strings. +--- + bfd/format.c | 2 ++ + 1 files changed, 2 insertions(+) + +diff --git a/bfd/format.c b/bfd/format.c +index 1d1363d..17b4855 100644 +--- a/bfd/format.c ++++ b/bfd/format.c +@@ -513,6 +513,8 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching) + *(const char **) &matching_vector[match_count] = name; + } + } ++ else if (matching_vector) ++ free (matching_vector); + return FALSE; + } + +-- +1.8.3.1 + diff --git a/binutils.spec b/binutils.spec index 05d5faf..522c91c 100644 --- a/binutils.spec +++ b/binutils.spec @@ -1,7 +1,7 @@ Summary: Binary utilities Name: binutils Version: 2.33.1 -Release: 6 +Release: 7 License: GPLv3+ URL: https://sourceware.org/binutils @@ -35,6 +35,7 @@ Patch18: ubsan-cr16-left-shift-cannot-be-represented-in-type-int.patch Patch19: More-signed-overflow-fixes.patch Patch20: Use-disassemble_info-private_data-in-place-of-insn_sets.patch Patch21: PR24960-Memory-leak-from-disassembler.patch +Patch22: bfd_check_format-memory-leak.patch Provides: bundled(libiberty) @@ -319,6 +320,12 @@ fi %{_infodir}/bfd*info* %changelog +* Fri May 15 2020 wangchen - 2.33.1-7 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix memory leak in bfd_check_format + * Thu Apr 02 2020 openEuler Buildteam - 2.33.1-6 - Type:bugfix - ID:NA -- Gitee