diff --git a/load.c b/load.c index c7f165f697..56dab418da 100644 --- a/load.c +++ b/load.c @@ -1015,7 +1015,7 @@ rb_require_internal(VALUE fname, int safe) RUBY_DTRACE_HOOK(FIND_REQUIRE_RETURN, RSTRING_PTR(fname)); if (found) { - if (!path || !(path = rb_fstring(path), ftptr = load_lock(RSTRING_PTR(path)))) { + if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) { result = 0; } else if (!*ftptr) { @@ -1042,7 +1042,7 @@ rb_require_internal(VALUE fname, int safe) } } EC_POP_TAG(); - load_unlock(ftptr, !state); + if (ftptr) load_unlock(RSTRING_PTR(path), !state); rb_set_safe_level_force(saved.safe); if (state) {