Commit fb935820 authored by Kouhei Sutou's avatar Kouhei Sutou

Fix wrong free function

mrb_locale_free() should be used for the return value of
mrb_locale_from_utf8().
parent a9abf65f
......@@ -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 */
......
......@@ -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
}
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment