This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[RFA/gas] macro.c, close some memory leaks.
- From: Michael Snyder <msnyder at vmware dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Wed, 09 Mar 2011 12:19:09 -0800
- Subject: [RFA/gas] macro.c, close some memory leaks.
Review?
2011-03-09 Michael Snyder <msnyder@vmware.com>
* macro.c (get_any_string): Free malloced br_buf.
(do_formals): Free 'formal'.
Index: macro.c
===================================================================
RCS file: /cvs/src/src/gas/macro.c,v
retrieving revision 1.54
diff -u -p -r1.54 macro.c
--- macro.c 18 Aug 2010 05:56:41 -0000 1.54
+++ macro.c 9 Mar 2011 20:14:43 -0000
@@ -407,7 +407,10 @@ get_any_string (int idx, sb *in, sb *out
&& in->ptr[idx] != tchar)
sb_add_char (out, in->ptr[idx++]);
if (idx == in->len)
- return idx;
+ {
+ free (br_buf);
+ return idx;
+ }
break;
case '(':
case '[':
@@ -488,6 +491,7 @@ do_formals (macro_entry *macro, int idx,
{
if (macro->formal_count)
--idx;
+ del_formal (formal); /* 'formal' goes out of scope. */
break;
}
idx = sb_skip_white (idx, in);