From 21d99677f6351d632d413198f0df7c9558de7e2f Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 13 Dec 2018 05:09:58 +0000 Subject: Separate RSTRING_PTR from a function call Do not apply RSTRING_PTR, a macro which evaluats its argument multiple times, on a function call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/date/date_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/date/date_core.c b/ext/date/date_core.c index e61d952cbf..49027e92b1 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -6661,7 +6661,9 @@ tmx_m_of(union DateData *x) static char * tmx_m_zone(union DateData *x) { - return RSTRING_PTR(m_zone(x)); + VALUE zone = m_zone(x); + /* TODO: fix potential dangling pointer */ + return RSTRING_PTR(zone); } static const struct tmx_funcs tmx_funcs = { -- cgit v1.2.3