This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


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

Re: Simple but crucial bug fix to gdb



Daniel Berlin <dan@cgsoftware.com> writes:
> Err, isn't this a memory leak?
> 
> You never free the name after complaining.
> 
> Same below

2001-06-01  Jim Blandy  <jimb@redhat.com>

	* partial-stab.h (case N_FUN: case 'f':, case N_FUN: case 'F':)
	Fix memory leak.

Index: partial-stab.h
===================================================================
RCS file: /cvs/src/src/gdb/partial-stab.h,v
retrieving revision 1.10
diff -c -r1.10 partial-stab.h
*** partial-stab.h	2001/06/01 20:37:11	1.10
--- partial-stab.h	2001/06/01 21:16:36
***************
*** 586,591 ****
--- 586,592 ----
              memcpy (name, namestring, name_len);
              name[name_len] = '\0';
              complain (&function_outside_compilation_unit, name);
+             xfree (name);
            }
  	CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
  #ifdef DBXREAD_ONLY
***************
*** 640,645 ****
--- 641,647 ----
              memcpy (name, namestring, name_len);
              name[name_len] = '\0';
              complain (&function_outside_compilation_unit, name);
+             xfree (name);
            }
  	CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
  #ifdef DBXREAD_ONLY


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