Module: kamailio
Branch: 5.4
Commit: b95e319d006a38fcc6385d704de82e553f7c2236
URL:
https://github.com/kamailio/kamailio/commit/b95e319d006a38fcc6385d704de82e5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-05-26T08:23:45+02:00
core/mem: q_malloc - use #else with DBG_QM_MALLOC for debug on freed fragments
(cherry picked from commit 764d5be0c44036bb4b86f841588fb0df3b4bb834)
(cherry picked from commit fc90e4c06c5df8c8a9d5cd615923c09a93b5a810)
---
Modified: src/core/mem/q_malloc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b95e319d006a38fcc6385d704de82e5…
Patch:
https://github.com/kamailio/kamailio/commit/b95e319d006a38fcc6385d704de82e5…
---
diff --git a/src/core/mem/q_malloc.c b/src/core/mem/q_malloc.c
index b518bfab81..b0f7625a40 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;