Skip to content

Commit 07bd1c4

Browse files
nobuhsbt
authored andcommitted
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
1 parent 486c7ef commit 07bd1c4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ext/date/date_core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6661,7 +6661,9 @@ tmx_m_of(union DateData *x)
66616661
static char *
66626662
tmx_m_zone(union DateData *x)
66636663
{
6664-
return RSTRING_PTR(m_zone(x));
6664+
VALUE zone = m_zone(x);
6665+
/* TODO: fix potential dangling pointer */
6666+
return RSTRING_PTR(zone);
66656667
}
66666668

66676669
static const struct tmx_funcs tmx_funcs = {

0 commit comments

Comments
 (0)