Module: kamailio
Branch: master
Commit: 764d5be0c44036bb4b86f841588fb0df3b4bb834
URL:
https://github.com/kamailio/kamailio/commit/764d5be0c44036bb4b86f841588fb0d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-04-26T11:22:20+02:00
core/mem: q_malloc - use #else with DBG_QM_MALLOC for debug on freed fragments
---
Modified: src/core/mem/q_malloc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/764d5be0c44036bb4b86f841588fb0d…
Patch:
https://github.com/kamailio/kamailio/commit/764d5be0c44036bb4b86f841588fb0d…
---
diff --git a/src/core/mem/q_malloc.c b/src/core/mem/q_malloc.c
index 94f972eae9..fb786ba635 100644
--- a/src/core/mem/q_malloc.c
+++ b/src/core/mem/q_malloc.c
@@ -509,7 +509,7 @@ void qm_free(void* qmp, void* p)
#ifdef DBG_QM_MALLOC
qm_debug_frag(qm, f, file, line);
- if (f->u.is_free){
+ if (unlikely(f->u.is_free)){
if(likely(cfg_get(core, core_cfg, mem_safety)==0)) {
LM_CRIT("BUG: freeing already freed pointer (%p),"
" called from %s: %s(%d), first free %s: %s(%ld) - aborting\n",
@@ -524,12 +524,13 @@ void qm_free(void* qmp, void* p)
}
MDBG("freeing frag. %p alloc'ed from %s: %s(%ld)\n",
f, f->file, f->func, f->line);
-#endif
+#else
if (unlikely(f->u.is_free)){
LM_INFO("freeing a free fragment (%p/%p) - ignore\n",
f, p);
return;
}
+#endif
size=f->size;
qm->used-=size;