RFA free(NULL) in bcache.c

Philippe De Muyter phdm@macqel.be
Wed Apr 12 02:05:00 GMT 2000


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.  */


More information about the Gdb-patches mailing list