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
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)
|
rb_raise(rb_eArgError, "bad environment variable " #var) : (void)0)
|
||||||
|
|
||||||
static inline const char *
|
static inline const char *
|
||||||
env_name(VALUE s)
|
env_name(volatile VALUE *s)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
SafeStringValue(s);
|
SafeStringValue(*s);
|
||||||
get_env_ptr(name, s);
|
get_env_ptr(name, *s);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define env_name(s) env_name(&(s))
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
env_delete(VALUE obj, VALUE name)
|
env_delete(VALUE obj, VALUE name)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user