Explorar o código

mem: f_malloc - properly set empty slot in free hash

- reported by Juha Heninanen
Daniel-Constantin Mierla %!s(int64=10) %!d(string=hai) anos
pai
achega
f6400aa197
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      mem/f_malloc.c

+ 4 - 1
mem/f_malloc.c

@@ -180,7 +180,10 @@ static inline void fm_extract_free(struct fm_block* qm, struct fm_frag* frag)
 	if(frag->prv_free) {
 		frag->prv_free->u.nxt_free = frag->u.nxt_free;
 	} else {
-		qm->free_hash[hash].first = frag->u.nxt_free;
+		if(frag->u.nxt_free!=qm->last_frag)
+			qm->free_hash[hash].first = frag->u.nxt_free;
+		else
+			qm->free_hash[hash].first = NULL;
 	}
 	if(frag->u.nxt_free && frag->u.nxt_free!=qm->last_frag) {
 		frag->u.nxt_free->prv_free = frag->prv_free;