1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Do not expect RSTRING_PTR valid after rb_fstring

This commit is contained in:
Nobuyoshi Nakada 2019-08-05 10:51:52 +09:00
parent 29092d35d3
commit 8cfa3d861c
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

4
load.c
View file

@ -1015,7 +1015,7 @@ rb_require_internal(VALUE fname, int safe)
RUBY_DTRACE_HOOK(FIND_REQUIRE_RETURN, RSTRING_PTR(fname)); RUBY_DTRACE_HOOK(FIND_REQUIRE_RETURN, RSTRING_PTR(fname));
if (found) { if (found) {
if (!path || !(path = rb_fstring(path), ftptr = load_lock(RSTRING_PTR(path)))) { if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) {
result = 0; result = 0;
} }
else if (!*ftptr) { else if (!*ftptr) {
@ -1042,7 +1042,7 @@ rb_require_internal(VALUE fname, int safe)
} }
} }
EC_POP_TAG(); EC_POP_TAG();
load_unlock(ftptr, !state); if (ftptr) load_unlock(RSTRING_PTR(path), !state);
rb_set_safe_level_force(saved.safe); rb_set_safe_level_force(saved.safe);
if (state) { if (state) {