On Thu, Nov 18, 1999 at 12:24:05AM +0100, Joerg Schumacher wrote: > Hi! > > > > The test > > > > > > if (environ == PL_origenviron) > > > > > > in util.c:my_setenv() assumes that the char **environ will only be > > > modified by perl itself. > > > > How does it assume it? Do you try to imply that environ may be > > changed before a call to perl_parse()? > > No, the scenario is as follows: > > 1) perl_parse() saves the pointer to the environment in PL_origenviron > 2) some extension interface (here Term::ReadLine::Gnu) is called > and does modify the pointer to the environment via putenv(3) > 3) the perlscript tries to assign a new value to an environment > variable and perl therefore calls my_setenv() > 4) my_setenv() does check if it needs to copy the environment but > the check returns false since (environ != PL_origenviron) > 5) my_setenv() calls Safefree() and free()s some unallocated memory *What* it calls Safefree() on? How can it be that this is unallocated? Judging by what you wrote, you are running some old version of Perl, such as 5.005_03. In 5.005_50 I can see that the only Safefree() is done on environ[i]. Due to documentation of putenv() I can see, environ[i] *should be* malloced. I think you need to concentrate on these questions. Ilya