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] wrstabs.c (stab_start_struct_type): Close memory leak.


OK?

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

	* wrstabs.c (stab_start_struct_type): Close memory leak.

Index: wrstabs.c
===================================================================
RCS file: /cvs/src/src/binutils/wrstabs.c,v
retrieving revision 1.20
diff -u -p -r1.20 wrstabs.c
--- wrstabs.c	28 Feb 2011 18:32:51 -0000	1.20
+++ wrstabs.c	8 Mar 2011 19:10:07 -0000
@@ -1337,11 +1337,15 @@ stab_start_struct_type (void *p, const c
 	   size);
 
   if (! stab_push_string (info, buf, tindex, definition, size))
-    return FALSE;
+    {
+      free (buf);
+      return FALSE;
+    }
 
   info->type_stack->fields = (char *) xmalloc (1);
   info->type_stack->fields[0] = '\0';
 
+  free (buf);
   return TRUE;
 }
 

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