aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-03-22 08:52:11 +1030
committerAlan Modra <amodra@gmail.com>2023-03-22 08:52:11 +1030
commitca26b8030e8c184bdeca7280e31c10c6e9fc3f78 (patch)
tree2160ab0f25338d169f71f11f9d4951354e60cfeb /gas
parent100f993c53a50352fd91554927142a2558f3481c (diff)
downloadbinutils-ca26b8030e8c184bdeca7280e31c10c6e9fc3f78.zip
binutils-ca26b8030e8c184bdeca7280e31c10c6e9fc3f78.tar.gz
binutils-ca26b8030e8c184bdeca7280e31c10c6e9fc3f78.tar.bz2
gas: expand_irp memory leaks
* macro.c (expand_irp): Free memory on error return paths.
Diffstat (limited to 'gas')
-rw-r--r--gas/macro.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gas/macro.c b/gas/macro.c
index 948d76d..c5959f6 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -1320,7 +1320,10 @@ expand_irp (int irpc, size_t idx, sb *in, sb *out, size_t (*get_line) (sb *))
sb_new (&sub);
if (! buffer_and_nest (NULL, "ENDR", &sub, get_line))
- return _("unexpected end of file in irp or irpc");
+ {
+ err = _("unexpected end of file in irp or irpc");
+ goto out2;
+ }
sb_new (&f.name);
sb_new (&f.def);
@@ -1328,7 +1331,10 @@ expand_irp (int irpc, size_t idx, sb *in, sb *out, size_t (*get_line) (sb *))
idx = get_token (idx, in, &f.name);
if (f.name.len == 0)
- return _("missing model parameter");
+ {
+ err = _("missing model parameter");
+ goto out1;
+ }
h = str_htab_create ();
@@ -1392,9 +1398,11 @@ expand_irp (int irpc, size_t idx, sb *in, sb *out, size_t (*get_line) (sb *))
}
htab_delete (h);
+ out1:
sb_kill (&f.actual);
sb_kill (&f.def);
sb_kill (&f.name);
+ out2:
sb_kill (&sub);
return err;