aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-06-20 10:39:13 +0930
committerAlan Modra <amodra@gmail.com>2022-06-20 10:39:52 +0930
commit8a24927bc8dbf6beac2000593b21235c3796dc35 (patch)
tree3978ad77e4776c02a0eb6c7475bb122b10f19fd1
parent49954a0d85403a7401efd95a648f39987da2a82b (diff)
downloadgdb-8a24927bc8dbf6beac2000593b21235c3796dc35.zip
gdb-8a24927bc8dbf6beac2000593b21235c3796dc35.tar.gz
gdb-8a24927bc8dbf6beac2000593b21235c3796dc35.tar.bz2
PR29261, memory leak in parse_stab_struct_fields
PR 29261 * stabs.c (parse_stab_struct_fields): Free "fields" on failure path.
-rw-r--r--binutils/stabs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/binutils/stabs.c b/binutils/stabs.c
index 796ff85..bf3f578 100644
--- a/binutils/stabs.c
+++ b/binutils/stabs.c
@@ -2367,7 +2367,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;
}