From: ivan Date: Wed, 21 Dec 2016 01:17:43 +0000 (-0800) Subject: The array is malloced by backtrace_symbols(), and must be freed X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=046099c9b59f29705b691f286ecb8f6bd97f4184;p=rocksdb.git 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 --- diff --git a/port/stack_trace.cc b/port/stack_trace.cc index bec0c994..74996e83 100644 --- a/port/stack_trace.cc +++ b/port/stack_trace.cc @@ -110,6 +110,7 @@ void PrintStack(int first_frames_to_skip) { fprintf(stderr, "#%-2d ", i - first_frames_to_skip); PrintStackTraceLine((symbols != nullptr) ? symbols[i] : nullptr, frames[i]); } + free(symbols); } static void StackTraceHandler(int sig) {