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

parent a0b58eed
...@@ -519,6 +519,8 @@ str_tr(mrb_state *mrb, mrb_value str, mrb_value p1, mrb_value p2, mrb_bool squee ...@@ -519,6 +519,8 @@ str_tr(mrb_state *mrb, mrb_value str, mrb_value p1, mrb_value p2, mrb_bool squee
continue; continue;
} }
if (c > 0x80) { 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); mrb_raisef(mrb, E_ARGUMENT_ERROR, "character (%i) out of range", c);
} }
lastch = c; lastch = c;
......
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