Module: kamailio
Branch: 5.2
Commit: f7c990e2ca6c7b2d43cf15723c71ba38065236e8
URL:
https://github.com/kamailio/kamailio/commit/f7c990e2ca6c7b2d43cf15723c71ba3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Henning Westerholt <hw(a)skalatan.de>
Date: 2020-01-23T15:53:22+01:00
core: qmalloc - print details of prev fragment when its tail is overwritten
- do it when check2 field is not touched
(cherry picked from commit bf1ba8d2d4519af50d44acfce5f34535fd1db8e0)
---
Modified: src/core/mem/q_malloc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/f7c990e2ca6c7b2d43cf15723c71ba3…
Patch:
https://github.com/kamailio/kamailio/commit/f7c990e2ca6c7b2d43cf15723c71ba3…
---
diff --git a/src/core/mem/q_malloc.c b/src/core/mem/q_malloc.c
index 52d2ef722c..47d8344bd1 100644
--- a/src/core/mem/q_malloc.c
+++ b/src/core/mem/q_malloc.c
@@ -118,6 +118,7 @@ static void qm_debug_check_frag(struct qm_block* qm, struct qm_frag*
f,
const char* file, unsigned int line,
const char* efile, unsigned int eline)
{
+ struct qm_frag *p;
if (f->check!=ST_CHECK_PATTERN){
LM_CRIT("BUG: qm: fragm. %p (address %p) "
"beginning overwritten (%lx)! Memory allocator was called "
@@ -147,6 +148,12 @@ static void qm_debug_check_frag(struct qm_block* qm, struct qm_frag*
f,
PREV_FRAG_END(f)->check1, PREV_FRAG_END(f)->check2, f,
(char*)f+sizeof(struct qm_frag), file, line, f->file, f->line,
efile, eline);
+ if(PREV_FRAG_END(f)->check2==END_CHECK_PATTERN2) {
+ p = FRAG_PREV(f);
+ LM_CRIT("BUG: qm: prev. fragm. tail overwritten [%p:%p]"
+ " - fragment marked by %s:%lu\n", p,
+ (char*)p+sizeof(struct qm_frag), p->file, p->line);
+ }
qm_status(qm);
abort();
}