Module: sip-router Branch: master Commit: cceb39f9fb8a55ab7e43f4a546d3d524f5acccd4 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cceb39f9...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Mon Nov 26 14:14:37 2012 +0100
mem: check debug info only when joining the next packet
- it was checked even it was not freeand not the case for a join
---
mem/q_malloc.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/mem/q_malloc.c b/mem/q_malloc.c index 497c3f9..bfa46fd 100644 --- a/mem/q_malloc.c +++ b/mem/q_malloc.c @@ -488,8 +488,8 @@ void qm_free(struct qm_block* qm, void* p) f->u.nxt_free=(void*)0x1L; /* bogus value, just to mark it as free */ /* join packets if possible*/ next=FRAG_NEXT(f); - if (((char*)next < (char*)qm->last_frag_end) &&( next->u.is_free)){ - /* join */ + if (((char*)next < (char*)qm->last_frag_end) && (next->u.is_free)){ + /* join next packet */ #ifdef DBG_QM_MALLOC qm_debug_frag(qm, next); #endif @@ -503,15 +503,15 @@ void qm_free(struct qm_block* qm, void* p) prev=FRAG_PREV(f); /* (struct qm_frag*)((char*)f - (struct qm_frag_end*)((char*)f- sizeof(struct qm_frag_end))->size);*/ + if (prev->u.is_free){ + /* join prev packet */ #ifdef DBG_QM_MALLOC - qm_debug_frag(qm, prev); + qm_debug_frag(qm, prev); #endif - if (prev->u.is_free){ - /*join*/ qm_detach_free(qm, prev); size+=prev->size+FRAG_OVERHEAD; qm->real_used-=FRAG_OVERHEAD; - qm->free_hash[GET_HASH(prev->size)].no--; /* FIXME slow */ + qm->free_hash[GET_HASH(prev->size)].no--; /* FIXME slow */ f=prev; } }