string-ext/string.c: fixed a memory leak.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-11-15 09:49:05 +09:00
parent a0b58eed46
commit e0a3800e5d
+2
View File
@@ -519,6 +519,8 @@ str_tr(mrb_state *mrb, mrb_value str, mrb_value p1, mrb_value p2, mrb_bool squee
continue;
}
if (c > 0x80) {
tr_free_pattern(mrb, &pat);
tr_free_pattern(mrb, rep);
mrb_raisef(mrb, E_ARGUMENT_ERROR, "character (%i) out of range", c);
}
lastch = c;