This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
RFA free(NULL) in bcache.c
- To: gdb-patches at sourceware dot cygnus dot com (gdb-patches at sourceware dot cygnus dot com)
- Subject: RFA free(NULL) in bcache.c
- From: "Philippe De Muyter" <phdm at macqel dot be>
- Date: Wed, 12 Apr 2000 11:05:44 +0200 (CEST)
I recently have had a core dump there, and the other instance of
`free (bcache->bucket)' in bache.c is protected against `free (NULL)', so
I think this is safe. OK to commit ?
Philippe De Muyter <phdm@macqel.be>
* bcache.c (free_bcache): Do not free NULL.
Index: gdb/bcache.c
===================================================================
RCS file: /cvs/src/src/gdb/bcache.c,v
retrieving revision 1.2
diff -u -p -r1.2 bcache.c
--- bcache.c 2000/02/08 04:39:01 1.2
+++ bcache.c 2000/04/12 08:52:26
@@ -189,7 +189,8 @@ void
free_bcache (struct bcache *bcache)
{
obstack_free (&bcache->cache, 0);
- free (bcache->bucket);
+ if (bcache->bucket)
+ free (bcache->bucket);
/* This isn't necessary, but at least the bcache is always in a
consistent state. */