public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [RFA/gas] macro.c, close some memory leaks.
@ 2011-03-09 20:19 Michael Snyder
  2011-03-30 15:11 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Snyder @ 2011-03-09 20:19 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 9 bytes --]

Review?


[-- Attachment #2: macro.txt --]
[-- Type: text/plain, Size: 885 bytes --]

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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFA/gas] macro.c, close some memory leaks.
  2011-03-09 20:19 [RFA/gas] macro.c, close some memory leaks Michael Snyder
@ 2011-03-30 15:11 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2011-03-30 15:11 UTC (permalink / raw)
  To: binutils

> 2011-03-09  Michael Snyder<msnyder@vmware.com>
>
> 	* macro.c (get_any_string): Free malloced br_buf.
> 	(do_formals): Free 'formal'.

Approved and applied.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-30 15:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09 20:19 [RFA/gas] macro.c, close some memory leaks Michael Snyder
2011-03-30 15:11 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).