Module: sip-router
Branch: master
Commit: fbf65a9405e9d1618a94a1e4c23390b8575445b8
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fbf65a9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Apr 2 09:50:17 2012 +0200
mem: safety check for f_malloc to avoind inserting two times free fragments
---
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 4888b6e..e3edf54 100644
--- a/mem/f_malloc.c
+++ b/mem/f_malloc.c
@@ -524,6 +524,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;