[asterisk-commits] murf: branch murf/bug6002 r105555 - /team/murf/bug6002/main/pbx.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 3 07:12:39 CST 2008
Author: murf
Date: Mon Mar 3 07:12:37 2008
New Revision: 105555
URL: http://svn.digium.com/view/asterisk?view=rev&rev=105555
Log:
This fix corrects a crash when there's an empty context, plus a memory corruption fix that happens on reloads. Looking good
Modified:
team/murf/bug6002/main/pbx.c
Modified: team/murf/bug6002/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/main/pbx.c?view=diff&rev=105555&r1=105554&r2=105555
==============================================================================
--- team/murf/bug6002/main/pbx.c (original)
+++ team/murf/bug6002/main/pbx.c Mon Mar 3 07:12:37 2008
@@ -6850,23 +6850,24 @@
/* then search thru and remove any extens that match registrar. */
struct ast_hashtab_iter *exten_iter;
struct ast_hashtab_iter *prio_iter;
- ast_log(LOG_NOTICE, "Delete all, context %s registrar=%s\n", tmp->name, tmp->registrar);
-
- exten_iter = ast_hashtab_start_traversal(tmp->root_table);
- while ((exten_item=ast_hashtab_next(exten_iter))) {
- prio_iter = ast_hashtab_start_traversal(exten_item->peer_table);
- while ((prio_item=ast_hashtab_next(prio_iter))) {
- if (strcmp(prio_item->registrar,registrar) != 0) {
- continue;
+
+ if (tmp->root_table) { /* it is entirely possible that the context is EMPTY */
+ exten_iter = ast_hashtab_start_traversal(tmp->root_table);
+ while ((exten_item=ast_hashtab_next(exten_iter))) {
+ prio_iter = ast_hashtab_start_traversal(exten_item->peer_table);
+ while ((prio_item=ast_hashtab_next(prio_iter))) {
+ if (strcmp(prio_item->registrar,registrar) != 0) {
+ continue;
+ }
+ ast_log(LOG_NOTICE, "Remove %s/%s/%d, registrar=%s\n",
+ tmp->name, prio_item->exten, prio_item->priority, registrar);
+
+ ast_context_remove_extension2(tmp, prio_item->exten, prio_item->priority, registrar);
}
- ast_log(LOG_NOTICE, "Remove %s/%s/%d, registrar=%s\n",
- tmp->name, prio_item->exten, prio_item->priority, registrar);
-
- ast_context_remove_extension2(tmp, prio_item->exten, prio_item->priority, registrar);
+ ast_hashtab_end_traversal(prio_iter);
}
- ast_hashtab_end_traversal(prio_iter);
- }
- ast_hashtab_end_traversal(exten_iter);
+ ast_hashtab_end_traversal(exten_iter);
+ }
/* delete the context if it's registrar matches, is empty, has refcount of 1, */
if (strcmp(tmp->registrar, registrar) == 0 && tmp->refcount < 2 && !tmp->root) {
More information about the asterisk-commits
mailing list