www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/01/20/06:50:31

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3C4AB616.9FDED42B@phekda.freeserve.co.uk>
Date: Sun, 20 Jan 2002 12:20:38 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: env.exe crash - reproducible test program
References: <10201191628 DOT AA14993 AT clio DOT rice DOT edu>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Charles Sandmann wrote:
> Note, I've discovered this doesn't work either and has nothing to do
> with putenv, so I have no idea what's going on.
> 
> #include <stdio.h>
> 
> extern char **environ;
> 
> int main (int argc, char **argv, char **envp)
> {
>   malloc_debug(3);
> 
>   free(environ);
>   return 0;
> }

I don't think this is a valid test. 'environ' is malloc'd in the start-up
code, which occurs before you call malloc_debug. So malloc will not record any
allocations until you turn on malloc debugging. So it will not "know" about
'environ'. (I checked this by stepping through the code in the debugger.)

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019