summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-08-07 12:03:52 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-08-07 12:03:52 +0000
commitda36d5700d9e0e66411d93595b6f654c85853fa1 (patch)
tree6ab1d2e1a8412d93c3819ee2b6c955139bdeadaf /parse.y
parentf5930c87174c369eaad42523ffd0f3cb8ff15b8a (diff)
merge revision(s) 53e9908d8afc7f03109b0aafd1698ab35f512b05: [Backport #15916]
Fix memory leak * string.c (str_replace_shared_without_enc): free previous buffer before replaced. * parse.y (gettable): make sure in advance that the `__FILE__` object shares a fstring, to get rid of replacement with the fstring later. TODO: this hack may be needed in other places. [Bug #15916] Co-Authored-By: luke-gru (Luke Gruber) <luke.gru@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 42f1a8f021..473ae0e216 100644
--- a/parse.y
+++ b/parse.y
@@ -8760,7 +8760,7 @@ gettable(struct parser_params *p, ID id, const YYLTYPE *loc)
if (NIL_P(file))
file = rb_str_new(0, 0);
else
- file = rb_str_dup(file);
+ file = rb_str_dup(rb_fstring(file));
node = NEW_STR(add_mark_object(p, file), loc);
}
return node;