[sr-dev] git:master:f6400aa1: mem: f_malloc - properly set empty slot in free hash

Daniel-Constantin Mierla miconda at gmail.com
Sun Sep 20 22:34:49 CEST 2015


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
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;




More information about the sr-dev mailing list