[svn-commits] murf: trunk r130297 - /trunk/main/pbx.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jul 11 17:03:19 CDT 2008


Author: murf
Date: Fri Jul 11 17:03:19 2008
New Revision: 130297

URL: http://svn.digium.com/view/asterisk?view=rev&rev=130297
Log:
(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.



Modified:
    trunk/main/pbx.c

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=130297&r1=130296&r2=130297
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Fri Jul 11 17:03:19 2008
@@ -213,7 +213,7 @@
 	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 @@
 		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 @@
 		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);




More information about the svn-commits mailing list