binutils/bfd_check_format-memory-leak.patch
2020-05-15 14:17:36 +08:00

28 lines
725 B
Diff

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