From d942e12a70d6ac540eb621cf92de29f1c6a47958 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 28 Feb 1999 02:12:07 +0000 Subject: [PATCH] (main) [DOUG_LEA_MALLOC]: Don't use unsetenv, it calls malloc in glibc 2.1. --- src/emacs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/emacs.c b/src/emacs.c index 956abe97b86..667b1db267b 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -571,8 +571,19 @@ main (argc, argv, envp) 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 checking. Can't use unsetenv, since that calls malloc. */ + { + char **p; + + for (p = envp; *p; p++) + if (strncmp (*p, "MALLOC_CHECK_=", 14) == 0) + { + do + *p = p[1]; + while (*++p); + break; + } + } malloc_set_state (malloc_state_ptr); free (malloc_state_ptr); } -- 2.39.2