!14 fix memory leak in bfd_check_format()

Merge pull request !14 from wangchen/binutils-branch
This commit is contained in:
openeuler-ci-bot 2020-05-15 15:51:09 +08:00 committed by Gitee
commit 3cca024aec
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,27 @@
From 9d78076ef8ef07890ad89c1122bdf49932a979a5 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
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

View File

@ -1,7 +1,7 @@
Summary: Binary utilities Summary: Binary utilities
Name: binutils Name: binutils
Version: 2.33.1 Version: 2.33.1
Release: 6 Release: 7
License: GPLv3+ License: GPLv3+
URL: https://sourceware.org/binutils 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 Patch19: More-signed-overflow-fixes.patch
Patch20: Use-disassemble_info-private_data-in-place-of-insn_sets.patch Patch20: Use-disassemble_info-private_data-in-place-of-insn_sets.patch
Patch21: PR24960-Memory-leak-from-disassembler.patch Patch21: PR24960-Memory-leak-from-disassembler.patch
Patch22: bfd_check_format-memory-leak.patch
Provides: bundled(libiberty) Provides: bundled(libiberty)
@ -319,6 +320,12 @@ fi
%{_infodir}/bfd*info* %{_infodir}/bfd*info*
%changelog %changelog
* Fri May 15 2020 wangchen <wangchen137@huawei.com> - 2.33.1-7
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix memory leak in bfd_check_format
* Thu Apr 02 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.33.1-6 * Thu Apr 02 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.33.1-6
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA