瀏覽代碼

fixed leak in maps freelist

ncannasse 7 年之前
父節點
當前提交
31c4aeab4a
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/std/maps.c

+ 2 - 0
src/std/maps.c

@@ -66,6 +66,7 @@ static void hl_freelist_add_range( hl_free_list *f, int pos, int count ) {
 			return;
 		} else if( pos + count == f->head ) {
 			f->head -= count;
+			f->nbuckets += count;
 			return;
 		} else {
 			int cur_pos = f->head, cur_count = f->nbuckets;
@@ -83,6 +84,7 @@ static void hl_freelist_add_range( hl_free_list *f, int pos, int count ) {
 	}
 	if( b < f->buckets + f->head && b->pos == pos + count ) {
 		b->pos -= count;
+		b->count += count;
 		// merge
 		if( prev && prev->pos + prev->count == b->pos ) {
 			prev->count += b->count;