Commit d3288088 authored by dearblue's avatar dearblue

Fix memory leak for hash table index if occur out of memory

parent 4d8ff2fb
...@@ -182,7 +182,7 @@ ht_index(mrb_state *mrb, htable *t) ...@@ -182,7 +182,7 @@ ht_index(mrb_state *mrb, htable *t)
if (!index || index->capa < size) { if (!index || index->capa < size) {
index = (segindex*)mrb_realloc_simple(mrb, index, sizeof(segindex)+sizeof(struct segkv*)*size); index = (segindex*)mrb_realloc_simple(mrb, index, sizeof(segindex)+sizeof(struct segkv*)*size);
if (index == NULL) { if (index == NULL) {
mrb_free(mrb, index); mrb_free(mrb, t->index);
t->index = NULL; t->index = NULL;
return; return;
} }
......
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