diff options
author | Rob Landley <rob@landley.net> | 2020-01-03 20:17:16 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2020-01-03 20:17:16 -0600 |
commit | 2c6b319f4686c35f7d6fabc494a319702844f3d6 (patch) | |
tree | edd5ee702408660163735e8c15fa4c5876168f7a /lib | |
parent | 9840fcdb428c712d21b057241e72ac9715ff6b28 (diff) | |
download | toybox-2c6b319f4686c35f7d6fabc494a319702844f3d6.tar.gz |
Only free the environment variables we didn't inherit from exec.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/env.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -23,9 +23,9 @@ long environ_bytes() void xclearenv(void) { if (toys.envc) { - char **ss; + int i; - for (ss = environ; *ss; ss++) free(*ss); + for (i = 0; environ[i]; i++) if (i>=toys.envc) free(environ[i]); free(environ); } toys.envc = 0; |