Fix wrong free function
mrb_locale_free() should be used for the return value of
mrb_locale_from_utf8().
MODIFY
mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
@@ -599,13 +599,13 @@ done:
/* warning */
char* msg = mrb_locale_from_utf8(parser->warn_buffer[0].message, -1);
printf("line %d: %s\n", parser->warn_buffer[0].lineno, msg);
- mrb_utf8_free(msg);
+ mrb_locale_free(msg);
}
if (0 < parser->nerr) {
/* syntax error */
char* msg = mrb_locale_from_utf8(parser->error_buffer[0].message, -1);
printf("line %d: %s\n", parser->error_buffer[0].lineno, msg);
- mrb_utf8_free(msg);
+ mrb_locale_free(msg);
}
else {
/* generate bytecode */

MODIFY
mrbgems/mruby-io/src/file.c
mrbgems/mruby-io/src/file.c
@@ -310,7 +310,7 @@ mrb_file__gethome(mrb_state *mrb, mrb_value klass)
}
home = mrb_locale_from_utf8(home, -1);
path = mrb_str_new_cstr(mrb, home);
- mrb_utf8_free(home);
+ mrb_locale_free(home);
return path;
#else
argc = mrb_get_argc(mrb);
@@ -327,7 +327,7 @@ mrb_file__gethome(mrb_state *mrb, mrb_value klass)
}
home = mrb_locale_from_utf8(home, -1);
path = mrb_str_new_cstr(mrb, home);
- mrb_utf8_free(home);
+ mrb_locale_free(home);
return path;
#endif
}

MODIFY
mrbgems/mruby-io/src/io.c
mrbgems/mruby-io/src/io.c
@@ -780,7 +780,7 @@ reopen:
mrb_str_modify(mrb, mrb_str_ptr(emsg));
mrb_sys_fail(mrb, RSTRING_PTR(emsg));
}
- mrb_utf8_free(fname);
+ mrb_locale_free(fname);
if (fd <= 2) {
mrb_fd_cloexec(mrb, fd);

Fix wrong free function

mrb_locale_free() should be used for the return value of
mrb_locale_from_utf8().