mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-09 09:03:24 +00:00
gas: expand_irp memory leaks
* macro.c (expand_irp): Free memory on error return paths.
This commit is contained in:
12
gas/macro.c
12
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);
|
sb_new (&sub);
|
||||||
if (! buffer_and_nest (NULL, "ENDR", &sub, get_line))
|
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.name);
|
||||||
sb_new (&f.def);
|
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);
|
idx = get_token (idx, in, &f.name);
|
||||||
if (f.name.len == 0)
|
if (f.name.len == 0)
|
||||||
return _("missing model parameter");
|
{
|
||||||
|
err = _("missing model parameter");
|
||||||
|
goto out1;
|
||||||
|
}
|
||||||
|
|
||||||
h = str_htab_create ();
|
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);
|
htab_delete (h);
|
||||||
|
out1:
|
||||||
sb_kill (&f.actual);
|
sb_kill (&f.actual);
|
||||||
sb_kill (&f.def);
|
sb_kill (&f.def);
|
||||||
sb_kill (&f.name);
|
sb_kill (&f.name);
|
||||||
|
out2:
|
||||||
sb_kill (&sub);
|
sb_kill (&sub);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
Reference in New Issue
Block a user