On Thu, Nov 18, 1999 at 01:31:11AM +0100, Joerg Schumacher wrote: > > > 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. OK, now it is us who look utterly confused... I was pretty sure that documentation of putenv() states that it free()s the old value, but most probably it just leaks... So your solution involves a static variable. Hmm... Since environment coming from main() is a global property, it is probably what should have been done. But nevertheless, your solution is a leak, since the environment set in the library will never be free()d. On the other hand, what else can we say instead of "tough luck": the library might have put a static string into environment too... Ilya