diff options
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1055,7 +1055,8 @@ ruby_setenv(name, value) environ = tmpenv; /* tell exec where it is now */ } if (!value) { - free(environ[i]); + if (environ[i] != origenviron[i]) + free(environ[i]); while (environ[i]) { environ[i] = environ[i+1]; i++; @@ -1067,7 +1068,8 @@ ruby_setenv(name, value) environ[i+1] = 0; /* make sure it's null terminated */ } else { - free(environ[i]); + if (environ[i] != origenviron[i]) + free(environ[i]); } environ[i] = ALLOC_N(char, strlen(name) + strlen(value) + 2); #ifndef MSDOS |