parse.y (mrbc_filename): should not raise exceptions

This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-03-22 17:33:21 +09:00
parent feabcfe29e
commit bdbc613ccb
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -6739,8 +6739,9 @@ mrbc_filename(mrb_state *mrb, mrbc_context *c, const char *s)
{
if (s) {
size_t len = strlen(s);
char *p = (char*)mrb_malloc(mrb, len + 1);
char *p = (char*)mrb_malloc_simple(mrb, len + 1);
if (p == NULL) return NULL;
memcpy(p, s, len + 1);
if (c->filename) {
mrb_free(mrb, c->filename);
+2 -1
View File
@@ -13315,8 +13315,9 @@ mrbc_filename(mrb_state *mrb, mrbc_context *c, const char *s)
{
if (s) {
size_t len = strlen(s);
char *p = (char*)mrb_malloc(mrb, len + 1);
char *p = (char*)mrb_malloc_simple(mrb, len + 1);
if (p == NULL) return NULL;
memcpy(p, s, len + 1);
if (c->filename) {
mrb_free(mrb, c->filename);