[Toybox] setenv memory leak.

Rob Landley rob at landley.net
Mon Apr 8 12:31:11 PDT 2019


On 4/8/19 1:42 PM, Rob Landley wrote:
> I'm inching towards reopening the toysh can of worms, and last time I opened it
> there was a problem with environment variable memory leaking in libc:
> 
>   https://landley.net/notes-2006.html#24-10-2006

Nevermind, creating a lib/env.c to do this stuff properly, with the usual
xsetenv() and friends.

This isn't hard, and I'm not gonna guess what libc du jour gets right...

(The design I had way back when, with an initial envc count that decrements
every time we drop something out of our initial environment, and everything else
is our allocation we can free again, seems quite reasonable. I should leave
/proc/self/environment alone the same way I leave /proc/self/cmdline alone, it's
what we inherited at exec() time not what we're using now.)

Rob


More information about the Toybox mailing list