This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/gas] config/obj-elf.c (obj_elf_section): Free malloced name.


Plug a memory leak.

OK?

2011-03-09  Michael Snyder  <msnyder@vmware.com>

	* obj-elf.c (obj_elf_section): Free malloced name.

Index: obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.138
diff -u -p -r1.138 obj-elf.c
--- obj-elf.c	6 Mar 2011 14:05:24 -0000	1.138
+++ obj-elf.c	9 Mar 2011 19:51:44 -0000
@@ -984,6 +984,7 @@ obj_elf_section (int push)
 	  if (beg == NULL)
 	    {
 	      ignore_rest_of_line ();
+	      xfree (name);
 	      return;
 	    }
 	  attr |= obj_elf_parse_section_letters (beg, strlen (beg), &clone);
@@ -1003,6 +1004,7 @@ obj_elf_section (int push)
 		  if (beg == NULL)
 		    {
 		      ignore_rest_of_line ();
+		      xfree (name);
 		      return;
 		    }
 		  type = obj_elf_section_type (beg, strlen (beg), TRUE);
@@ -1084,6 +1086,7 @@ obj_elf_section (int push)
 		{
 		  as_bad (_("character following name is not '#'"));
 		  ignore_rest_of_line ();
+		  xfree (name);
 		  return;
 		}
 	      beg = ++input_line_pointer;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]