Module: kamailio
Branch: master
Commit: bf1ba8d2d4519af50d44acfce5f34535fd1db8e0
URL:
https://github.com/kamailio/kamailio/commit/bf1ba8d2d4519af50d44acfce5f3453…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-11-03T10:30:09+01:00
core: qmalloc - print details of prev fragment when its tail is overwritten
- do it when check2 field is not touched
---
Modified: src/core/mem/q_malloc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/bf1ba8d2d4519af50d44acfce5f3453…
Patch:
https://github.com/kamailio/kamailio/commit/bf1ba8d2d4519af50d44acfce5f3453…
---
diff --git a/src/core/mem/q_malloc.c b/src/core/mem/q_malloc.c
index b718dfa3bf..2fd45fe50e 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();
}