summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Murphy <murf@digium.com>2008-07-11 22:03:19 +0000
committerSteve Murphy <murf@digium.com>2008-07-11 22:03:19 +0000
commit42942b790d919f2cb8a27328def075de1ed732e9 (patch)
treee3ad98ac3d2eeb7ff74286dc1e28c907317381ec
parentb247dcf4326d88d651fde4e57d36f8ddd0fd05e0 (diff)
(closes issue #13041)
Reported by: eliel OK, now the context registrar slot is strdup'd. It is freed on destruction. I don't see the need to do this with all the structs' registrar fields, but if some wild case proves they should also be handled this way, then we can put in the extra work at that time. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@130297 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--main/pbx.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main/pbx.c b/main/pbx.c
index f6fd56137..416312e9a 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -213,7 +213,7 @@ struct ast_context {
struct ast_context *next; /*!< Link them together */
struct ast_include *includes; /*!< Include other contexts */
struct ast_ignorepat *ignorepats; /*!< Patterns for which to continue playing dialtone */
- const char *registrar; /*!< Registrar */
+ char *registrar; /*!< Registrar -- make sure you malloc this, as the registrar may have to survive module unloads */
int refcount; /*!< each module that would have created this context should inc/dec this as appropriate */
AST_LIST_HEAD_NOLOCK(, ast_sw) alts; /*!< Alternative switches */
ast_mutex_t macrolock; /*!< A lock to implement "exclusive" macros - held whilst a call is executing in the macro */
@@ -5617,7 +5617,7 @@ struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts,
strcpy(tmp->name, name);
tmp->root = NULL;
tmp->root_table = NULL;
- tmp->registrar = registrar;
+ tmp->registrar = ast_strdup(registrar);
tmp->includes = NULL;
tmp->ignorepats = NULL;
tmp->refcount = 1;
@@ -7305,6 +7305,9 @@ static void __ast_internal_context_destroy( struct ast_context *con)
ipi = ipi->next;
ast_free(ipl);
}
+ if (tmp->registrar)
+ ast_free(tmp->registrar);
+
/* destroy the hash tabs */
if (tmp->root_table) {
ast_hashtab_destroy(tmp->root_table, 0);