Module: kamailio Branch: 4.3 Commit: b09ccd2d16982c16babe5ba71c3e7d94bec71706 URL: https://github.com/kamailio/kamailio/commit/b09ccd2d16982c16babe5ba71c3e7d94...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2015-09-20T22:36:46+02:00
mem: f_malloc - properly set empty slot in free hash
- reported by Juha Heninanen
(cherry picked from commit f6400aa19736e3f6acf00f3c79f5ddaaf2acbcee)
---
Modified: mem/f_malloc.c
---
Diff: https://github.com/kamailio/kamailio/commit/b09ccd2d16982c16babe5ba71c3e7d94... Patch: https://github.com/kamailio/kamailio/commit/b09ccd2d16982c16babe5ba71c3e7d94...
---
diff --git a/mem/f_malloc.c b/mem/f_malloc.c index a62665e..90fa9ca 100644 --- a/mem/f_malloc.c +++ b/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;