mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
hash.c: fix dangling pointer
* hash.c (env_name): also store a coerced string to get rid of a dangling pointer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0e198d37bb
commit
7eeaf208b4
1 changed files with 5 additions and 3 deletions
8
hash.c
8
hash.c
|
@ -2547,14 +2547,16 @@ env_str_new2(const char *ptr)
|
|||
rb_raise(rb_eArgError, "bad environment variable " #var) : (void)0)
|
||||
|
||||
static inline const char *
|
||||
env_name(VALUE s)
|
||||
env_name(volatile VALUE *s)
|
||||
{
|
||||
const char *name;
|
||||
SafeStringValue(s);
|
||||
get_env_ptr(name, s);
|
||||
SafeStringValue(*s);
|
||||
get_env_ptr(name, *s);
|
||||
return name;
|
||||
}
|
||||
|
||||
#define env_name(s) env_name(&(s))
|
||||
|
||||
static VALUE
|
||||
env_delete(VALUE obj, VALUE name)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue