Module: sip-router
Branch: 3.1
Commit: 1db591ed633a101a150f9b66bf6556329590dc64
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1db591e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Anca Vamanu <anca.vamanu(a)1and1.ro>
Date: Mon Apr 2 09:50:17 2012 +0200
mem: safety check for f_malloc to avoind inserting two times free fragments
(cherry picked from commit fbf65a9405e9d1618a94a1e4c23390b8575445b8)
---
mem/f_malloc.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/mem/f_malloc.c b/mem/f_malloc.c
index 6fa88c3..54cbb34 100644
--- a/mem/f_malloc.c
+++ b/mem/f_malloc.c
@@ -440,6 +440,11 @@ void fm_free(struct fm_block* qm, void* p)
MDBG("fm_free: freeing block alloc'ed from %s: %s(%ld)\n",
f->file, f->func, f->line);
#endif
+ if(unlikely(f->u.nxt_free!=NULL)) {
+ LM_INFO("freeing a free fragment (%p/%p) - ignore\n",
+ f, p);
+ return;
+ }
size=f->size;
#if defined(DBG_F_MALLOC) || defined(MALLOC_STATS)
qm->used-=size;