# HG changeset patch # User Gerd Moellmann # Date 972313335 0 # Node ID 416924b6f303ad93aa8fb597b4761736c7e435c6 # Parent 3558c9628dc9e4f53c6684ea2189ef6230f0e461 (emacs_blocked_free) [GC_MALLOC_CHECK]: Handle freeing null. diff -r 3558c9628dc9 -r 416924b6f303 src/alloc.c --- 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;