aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/env.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/env.c b/lib/env.c
index af0ec29d..33ad0005 100644
--- a/lib/env.c
+++ b/lib/env.c
@@ -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;