From 5287afb80c96386818bcecc57c16b576eacb47f7 Mon Sep 17 00:00:00 2001
From: Jonathan Rose <jrose@digium.com>
Date: Mon, 13 May 2013 19:24:59 +0000
Subject: [PATCH] pbx: Fix lack of cleanup on macrolock and context_table

(closes issue ASTERISK-21723)
Reported by: Corey Farrell
Patches:
    core-pbx-cleanup.patch uploaded by Correy Farrell (license 5909)
........

Merged revisions 388532 from http://svn.asterisk.org/svn/asterisk/branches/1.8


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@388578 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/pbx.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/main/pbx.c b/main/pbx.c
index b4c5d4c3aa..607cffbc6a 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -10503,6 +10503,7 @@ static void __ast_internal_context_destroy( struct ast_context *con)
 	}
 	tmp->root = NULL;
 	ast_rwlock_destroy(&tmp->lock);
+	ast_mutex_destroy(&tmp->macrolock);
 	ast_free(tmp);
 }
 
@@ -12173,6 +12174,10 @@ static void pbx_shutdown(void)
 		ao2_ref(statecbs, -1);
 		statecbs = NULL;
 	}
+	if (contexts_table) {
+		ast_hashtab_destroy(contexts_table, NULL);
+	}
+	pbx_builtin_clear_globals();
 }
 
 int ast_pbx_init(void)
-- 
GitLab