]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
ast_bt_get_symbols: Prevent double-free.
authorCorey Farrell <git@cfware.com>
Fri, 13 Oct 2017 13:51:09 +0000 (09:51 -0400)
committerCorey Farrell <git@cfware.com>
Fri, 13 Oct 2017 13:51:09 +0000 (09:51 -0400)
It's possible for bfdobj to be created but syms not created.  If syms
was not allocated in the current loop iteration but was allocated in the
previous iteration it would crash.

ASTERISK-27340

Change-Id: I5b110c609f6dfe91339f782a99a431bca5837363

main/backtrace.c

index a1156467f703e2c60731ba8b65769996d9389c94..16598905480d98a4958610f86e84e080d3452c18 100644 (file)
@@ -173,6 +173,7 @@ char **__ast_bt_get_symbols(void **addresses, size_t num_frames)
                if (bfdobj) {
                        bfd_close(bfdobj);
                        ast_std_free(syms);
+                       syms = NULL;
                }
 
                /* Default output, if we cannot find the information within BFD */