From a83fee2c5629b8c4c73f18043df72d2a4edd5ccd Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Mon, 23 Oct 2000 15:03:55 +0000 Subject: [PATCH] (emacs_blocked_free) [GC_MALLOC_CHECK]: Handle freeing null. --- src/ChangeLog | 11 +++++++++-- src/alloc.c | 31 ++++++++++++++++--------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3cb5ce46d45..8286648aca1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2000-10-23 Gerd Moellmann + + * xterm.c (x_connection_closed): Reset handling_signal. + + * alloc.c (emacs_blocked_free) [GC_MALLOC_CHECK]: Handle freeing + null. + 2000-10-23 Miles Bader * window.c (window_scroll_pixel_based, window_scroll_line_based): @@ -11,7 +18,7 @@ that when a font can't be exactly centered, it errs up rather than down. -2000-10-22 15:07:47 ShengHuo ZHU +2000-10-22 ShengHuo ZHU * fns.c (Fbase64_decode_string): The decoded result should be unibyte. @@ -21,7 +28,7 @@ * dispextern.h [macintosh]: Include macgui.h instead of macterm.h. * dispnew.c [macintosh]: Include macterm.h. - (init_display) [macintosh]: initialization for window system. + (init_display) [macintosh]: Initialization for window system. * emacs.c (main) [macintosh]: Call syms_of_textprop, syms_of_macfns, syms_of_ccl, syms_of_fontset, syms_of_xterm, diff --git a/src/alloc.c b/src/alloc.c index 54c4b447fde..625dc14720f 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -655,22 +655,23 @@ emacs_blocked_free (ptr) 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; -- 2.39.2