# HG changeset patch # User Andreas Schwab # Date 920021032 0 # Node ID 61704c572291113cd5aa7126c1f0415b79edcada # Parent f401b26570a43650363c9380ed02b3fee31c5ecf (main) [DOUG_LEA_MALLOC]: Work around a bug in glibc's malloc. diff -r f401b26570a4 -r 61704c572291 src/emacs.c --- a/src/emacs.c Fri Feb 26 07:07:13 1999 +0000 +++ b/src/emacs.c Fri Feb 26 09:23:52 1999 +0000 @@ -103,6 +103,9 @@ extern void *malloc_get_state (); /* From glibc, a routine that overwrites the malloc internal state. */ extern void malloc_set_state (); +/* Non-zero if the MALLOC_CHECK_ enviroment variable was set while + dumping. Used to work around a bug in glibc's malloc. */ +int malloc_using_checking; #endif /* Variable whose value is symbol giving operating system type. */ @@ -565,9 +568,16 @@ #ifdef DOUG_LEA_MALLOC if (initialized) { + if (!malloc_using_checking) + /* Work around a bug in glibc's malloc. MALLOC_CHECK_ must be + ignored if the heap to be restored was constructed without + malloc checking. */ + unsetenv ("MALLOC_CHECK_"); malloc_set_state (malloc_state_ptr); free (malloc_state_ptr); } + else + malloc_using_checking = getenv ("MALLOC_CHECK_") != NULL; #endif #ifdef RUN_TIME_REMAP