]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
The array is malloced by backtrace_symbols(), and must be freed
authorivan <sjingivan@gmail.com>
Wed, 21 Dec 2016 01:17:43 +0000 (17:17 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 21 Dec 2016 01:24:12 +0000 (17:24 -0800)
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

port/stack_trace.cc

index bec0c994b85777dc3f0148e3edc9da961c501d77..74996e8361cec78399fc38a7d03a858ba70d9312 100644 (file)
@@ -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) {