mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #4378 from dearblue/memleak-hashtable
Fix memory leak for hash table index if occur out of memory
This commit is contained in:
+1
-1
@@ -182,7 +182,7 @@ ht_index(mrb_state *mrb, htable *t)
|
||||
if (!index || index->capa < size) {
|
||||
index = (segindex*)mrb_realloc_simple(mrb, index, sizeof(segindex)+sizeof(struct segkv*)*size);
|
||||
if (index == NULL) {
|
||||
mrb_free(mrb, index);
|
||||
mrb_free(mrb, t->index);
|
||||
t->index = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user