changeset 32776:416924b6f303

(emacs_blocked_free) [GC_MALLOC_CHECK]: Handle freeing null.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 23 Oct 2000 15:02:15 +0000
parents 3558c9628dc9
children a266436c0793
files src/alloc.c
diffstat 1 files changed, 16 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/alloc.c	Mon Oct 23 15:01:52 2000 +0000
+++ b/src/alloc.c	Mon Oct 23 15:02:15 2000 +0000
@@ -655,22 +655,23 @@
   BLOCK_INPUT;
 
 #ifdef GC_MALLOC_CHECK
-  {
-    struct mem_node *m;
+  if (ptr)
+    {
+      struct mem_node *m;
   
-    m = mem_find (ptr);
-    if (m == MEM_NIL || m->start != ptr)
-      {
-	fprintf (stderr,
-		 "Freeing `%p' which wasn't allocated with malloc\n", ptr);
-	abort ();
-      }
-    else
-      {
-	/* fprintf (stderr, "free %p...%p (%p)\n", m->start, m->end, ptr); */
-	mem_delete (m);
-      }
-  }
+      m = mem_find (ptr);
+      if (m == MEM_NIL || m->start != ptr)
+	{
+	  fprintf (stderr,
+		   "Freeing `%p' which wasn't allocated with malloc\n", ptr);
+	  abort ();
+	}
+      else
+	{
+	  /* fprintf (stderr, "free %p...%p (%p)\n", m->start, m->end, ptr); */
+	  mem_delete (m);
+	}
+    }
 #endif /* GC_MALLOC_CHECK */
   
   __free_hook = old_free_hook;