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