Merge pull request #5842 from mattn/fix-use-after-free

fix use after free
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-10-31 07:28:24 +09:00
committed by GitHub
+1 -1
View File
@@ -261,7 +261,7 @@ mrb_file_realpath(mrb_state *mrb, mrb_value klass)
result = mrb_str_new_capa(mrb, PATH_MAX);
if (realpath(cpath, RSTRING_PTR(result)) == NULL) {
mrb_locale_free(cpath);
mrb_sys_fail(mrb, cpath);
mrb_sys_fail(mrb, RSTRING_CSTR(mrb, pathname));
return result; /* not reached */
}
mrb_locale_free(cpath);