Browse Source

fixed leak in maps freelist

ncannasse 7 years ago
parent
commit
31c4aeab4a
1 changed files with 2 additions and 0 deletions
  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;