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
This commit is contained in:
Matthew Jordan 2013-08-08 13:54:46 +00:00
parent 88bef0b3dd
commit 2a8219b64a
1 changed files with 2 additions and 1 deletions

View File

@ -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");