This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix memory leak in cp-demangle.c
- To: Alex Samuel <samuel at codesourcery dot com>
- Subject: Fix memory leak in cp-demangle.c
- From: Jim Blandy <jimb at zwingli dot cygnus dot com>
- Date: Thu, 15 Mar 2001 18:17:45 -0500 (EST)
- CC: gcc-patches at gcc dot gnu dot org
Perhaps there's some strange sharing going on that makes this the
wrong thing to do, but I didn't notice any.
2001-03-15 Jim Blandy <jimb@redhat.com>
* cp-demangle.c (string_list_delete): Don't forget to free the
actual contents of the string.
Index: libiberty/cp-demangle.c
===================================================================
RCS file: /cvs/src/src/libiberty/cp-demangle.c,v
retrieving revision 1.8
diff -c -c -3 -p -r1.8 cp-demangle.c
*** libiberty/cp-demangle.c 2001/02/02 18:58:39 1.8
--- libiberty/cp-demangle.c 2001/03/15 23:09:50
*************** string_list_delete (node)
*** 415,420 ****
--- 415,421 ----
while (node != NULL)
{
string_list_t next = node->next;
+ free (node->string.s);
free (node);
node = next;
}