From 2a8219b64a2886457326e3f0d14317023d9f1652 Mon Sep 17 00:00:00 2001 From: Matthew Jordan <mjordan@digium.com> Date: Thu, 8 Aug 2013 13:54:46 +0000 Subject: [PATCH] Prevent spurious memory error when appending backtrace with MALLOC_DEBUG Backtraces are allocated outside of the usual memory tracking performed by MALLOC_DEBUG. This allows them to be used by the memory tracking enabled by that build option; however, it also means that when backtraces are disposed of they have to be done so outside of the re-defined free. This patch undef's free prior to disposing of the allocated backtrace when a backtrace is appended as a result of 'core show locks'. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396391 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/utils.c b/main/utils.c index 91e0a2ced5..b19148b7d9 100644 --- a/main/utils.c +++ b/main/utils.c @@ -862,7 +862,8 @@ static void append_backtrace_information(struct ast_str **str, struct ast_bt *bt for (frame_iterator = 0; frame_iterator < num_frames; ++frame_iterator) { ast_str_append(str, 0, "\t%s\n", symbols[frame_iterator]); } - +/* Prevent MALLOC_DEBUG from complaining */ +#undef free free(symbols); } else { ast_str_append(str, 0, "\tCouldn't retrieve backtrace symbols\n"); -- GitLab