The array is malloced by backtrace_symbols(), and must be freed

Summary:
The address of the array of string pointers is returned as the function result of backtrace_symbols().  This array is malloced by backtrace_symbols(), and must be freed by the caller.
Closes https://github.com/facebook/rocksdb/pull/1692

Differential Revision: D4355737

Pulled By: IslamAbdelRahman

fbshipit-source-id: 5742035
This commit is contained in:
ivan 2016-12-20 17:17:43 -08:00 committed by Facebook Github Bot
parent 6ff2c8d7f7
commit 046099c9b5

View File

@ -110,6 +110,7 @@ void PrintStack(int first_frames_to_skip) {
fprintf(stderr, "#%-2d ", i - first_frames_to_skip); fprintf(stderr, "#%-2d ", i - first_frames_to_skip);
PrintStackTraceLine((symbols != nullptr) ? symbols[i] : nullptr, frames[i]); PrintStackTraceLine((symbols != nullptr) ? symbols[i] : nullptr, frames[i]);
} }
free(symbols);
} }
static void StackTraceHandler(int sig) { static void StackTraceHandler(int sig) {