aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emacs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 40c1b16f745..956abe97b86 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -103,6 +103,9 @@ void *malloc_state_ptr;
103extern void *malloc_get_state (); 103extern void *malloc_get_state ();
104/* From glibc, a routine that overwrites the malloc internal state. */ 104/* From glibc, a routine that overwrites the malloc internal state. */
105extern void malloc_set_state (); 105extern void malloc_set_state ();
106/* Non-zero if the MALLOC_CHECK_ enviroment variable was set while
107 dumping. Used to work around a bug in glibc's malloc. */
108int malloc_using_checking;
106#endif 109#endif
107 110
108/* Variable whose value is symbol giving operating system type. */ 111/* Variable whose value is symbol giving operating system type. */
@@ -565,9 +568,16 @@ main (argc, argv, envp)
565#ifdef DOUG_LEA_MALLOC 568#ifdef DOUG_LEA_MALLOC
566 if (initialized) 569 if (initialized)
567 { 570 {
571 if (!malloc_using_checking)
572 /* Work around a bug in glibc's malloc. MALLOC_CHECK_ must be
573 ignored if the heap to be restored was constructed without
574 malloc checking. */
575 unsetenv ("MALLOC_CHECK_");
568 malloc_set_state (malloc_state_ptr); 576 malloc_set_state (malloc_state_ptr);
569 free (malloc_state_ptr); 577 free (malloc_state_ptr);
570 } 578 }
579 else
580 malloc_using_checking = getenv ("MALLOC_CHECK_") != NULL;
571#endif 581#endif
572 582
573#ifdef RUN_TIME_REMAP 583#ifdef RUN_TIME_REMAP