Module: kamailio
Branch: master
Commit: f6400aa19736e3f6acf00f3c79f5ddaaf2acbcee
URL: 
https://github.com/kamailio/kamailio/commit/f6400aa19736e3f6acf00f3c79f5ddaaf2acbcee

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2015-09-20T22:33:57+02:00

mem: f_malloc - properly set empty slot in free hash

- reported by Juha Heninanen

---

Modified: mem/f_malloc.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/f6400aa19736e3f6acf00f3c79f5ddaaf2acbcee.diff
Patch: 
https://github.com/kamailio/kamailio/commit/f6400aa19736e3f6acf00f3c79f5ddaaf2acbcee.patch

---

diff --git a/mem/f_malloc.c b/mem/f_malloc.c
index 90efda2..b0376eb 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;


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to