From d88510a426e0c310ecfe9955837fdbc9fdc6aa51 Mon Sep 17 00:00:00 2001 From: liningjie Date: Tue, 15 Aug 2023 02:56:30 +0800 Subject: [PATCH] PR29261, memory leak in parse_stab_struct_fields PR 29261 * stabs.c (parse_stab_struct_fields): Free "fields" on failure path. --- binutils/stabs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/binutils/stabs.c b/binutils/stabs.c index 395ed52d..207dc52f 100644 --- a/binutils/stabs.c +++ b/binutils/stabs.c @@ -2368,7 +2368,10 @@ parse_stab_struct_fields (void * dhandle, if (! parse_stab_one_struct_field (dhandle, info, pp, p, fields + c, staticsp, p_end)) - return FALSE; + { + free (fields); + return FALSE; + } ++c; } -- 2.33.0