path: root/hash.c
diff options
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-25 22:43:23 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-25 22:43:23 (GMT)
commit7eeaf208b484f257bc6c04e4229cb924e00a18c1 (patch)
tree8611acb026267006c8e2a60507e3c161f336ff56 /hash.c
parent0e198d37bb0703971b3231b9ad14488dbd3b0f85 (diff)
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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
1 files changed, 5 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index d6ac93f..56cedf0 100644
--- a/hash.c
+++ b/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)