Should not free the pointer in `realloc` since it can cause
use-after-free problem.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-07-02 10:41:03 +09:00
parent 612e5d6aad
commit 97319697c8
-1
View File
@@ -225,7 +225,6 @@ mrb_realloc(mrb_state *mrb, void *p, size_t len)
p2 = mrb_realloc_simple(mrb, p, len);
if (len == 0) return p2;
if (p2 == NULL) {
mrb_free(mrb, p);
mrb->gc.out_of_memory = TRUE;
mrb_raise_nomemory(mrb);
}