develooper Front page | perl.perl5.porters | Postings from November 1999

Re: [ID 19991116.002] perl5.005_02: my_setenv() and Term::ReadLine::Gnu

From:
Ilya Zakharevich
Date:
November 17, 1999 19:09
Subject:
Re: [ID 19991116.002] perl5.005_02: my_setenv() and Term::ReadLine::Gnu
Message ID:
199911180309.WAA04811@monk.mps.ohio-state.edu
Joerg Schumacher writes:
> 
> Hi!
> 
> > > But the free() is called with the pointer to a memory block which has
> > > never been malloc()'ed by perl.  
> > 
> > You look utterly confused.  First you claim that this is not a problem
> > with several mismatched malloc()s, now you say that it is.
> 
> Nope.  All I say is that you MUST NOT free() memory which hasn't been
> malloc()ed before.  The memory block which perl tries to free() in
> Safefree() is the original block passed via exec(2).  This block
> hasn't been malloc()ed and therefore perl must not free() it.

Let me restate things to syncronize our understanding:

a) Perl uses PL_origenviron variable to understand when environ is malloc()ed.

   You do not claim that this scheme is broken (though AFAICS, it will
   work correct only if perl_parse is called only once).

b) Perl thinks that if environ is malloc()ed, then environ[i] is malloc()ed;

   You claim that this assumption is unwarranted.  This claim looks correct.

However, in view of the above two statements your patch is still
broken, since AFAICS it does not address existence of two different
questions.

Ilya



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About