From ee65d5ac7c6a47734662a431b4cea54cd3d58a3b Mon Sep 17 00:00:00 2001
From: Corey Farrell <git@cfware.com>
Date: Fri, 13 Oct 2017 09:51:09 -0400
Subject: [PATCH] ast_bt_get_symbols: Prevent double-free.

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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/main/backtrace.c b/main/backtrace.c
index 0b29385fdc..aed4ffd94a 100644
--- a/main/backtrace.c
+++ b/main/backtrace.c
@@ -172,6 +172,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 */
-- 
GitLab