1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Env values removed by ENV.clear are not used

This commit is contained in:
Nobuyoshi Nakada 2020-04-18 21:30:53 +09:00
parent 97e8c72e56
commit 0a986b81e1
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
Notes: git 2020-04-19 00:35:33 +09:00

7
hash.c
View file

@ -5826,10 +5826,9 @@ rb_env_clear(void)
keys = env_keys(TRUE);
for (i=0; i<RARRAY_LEN(keys); i++) {
VALUE val = rb_f_getenv(Qnil, RARRAY_AREF(keys, i));
if (!NIL_P(val)) {
env_delete(RARRAY_AREF(keys, i));
}
VALUE key = RARRAY_AREF(keys, i);
const char *nam = RSTRING_PTR(key);
ruby_setenv(nam, 0);
}
RB_GC_GUARD(keys);
return envtbl;