From 766af058762b2c4e21b69f335adf77265fe9509a Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sat, 13 Aug 2022 20:58:29 +0100 Subject: [PATCH] Dump stack for "bad memory reference". Bug 2904 --- src/src/exim.c | 2 +- src/src/functions.h | 1 + src/src/store.c | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/src/exim.c b/src/src/exim.c index 23e206d2a..ea4286af3 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -232,7 +232,7 @@ exit(1); ***********************************************/ #define STACKDUMP_MAX 24 -static void +void stackdump(void) { #ifndef NO_EXECINFO diff --git a/src/src/functions.h b/src/src/functions.h index e71823410..92a4831e3 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -547,6 +547,7 @@ extern int stdin_ferror(void); extern BOOL stdin_hasc(void); extern int stdin_ungetc(int); +extern void stackdump(void); extern void store_exit(void); extern void store_init(void); extern void store_writeprotect(int); diff --git a/src/src/store.c b/src/src/store.c index c98fcbf21..d99d2ab69 100644 --- a/src/src/store.c +++ b/src/src/store.c @@ -274,6 +274,9 @@ for (pp = paired_pools; pp < paired_pools + N_PAIRED_POOLS; pp++) for (b = pp->chainbase; b; b = b->next) if (is_pointer_in_block(b, p)) return pp; +#ifndef COMPILE_UTILITY +stackdump(); +#endif log_write(0, LOG_MAIN|LOG_PANIC_DIE, "bad memory reference; pool not found, at %s %d", func, linenumber); return NULL; -- 2.30.2