[asterisk-commits] file: branch file/usecnt-cleanup r54523 - /team/file/usecnt-cleanup/main/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Feb 14 17:07:18 MST 2007


Author: file
Date: Wed Feb 14 18:07:17 2007
New Revision: 54523

URL: http://svn.digium.com/view/asterisk?view=rev&rev=54523
Log:
Remove linkage from list before passing to unregister function or else the unregister function may remove it a second time... and that is bad.

Modified:
    team/file/usecnt-cleanup/main/loader.c

Modified: team/file/usecnt-cleanup/main/loader.c
URL: http://svn.digium.com/view/asterisk/team/file/usecnt-cleanup/main/loader.c?view=diff&rev=54523&r1=54522&r2=54523
==============================================================================
--- team/file/usecnt-cleanup/main/loader.c (original)
+++ team/file/usecnt-cleanup/main/loader.c Wed Feb 14 18:07:17 2007
@@ -483,6 +483,7 @@
 		if (!AST_LIST_EMPTY(&mod->links)) {
 			struct ast_module_link *link = NULL;
 			AST_LIST_TRAVERSE_SAFE_BEGIN(&mod->links, link, list) {
+				AST_LIST_REMOVE_CURRENT(&mod->links, list);
 				/* Unregister linkage on behalf of the module */
 				if (link->registered == AST_MODULE_REGISTERED_APPLICATION)
 					res = ast_unregister_application((const char*)link->data);
@@ -490,8 +491,6 @@
 					ast_channel_unregister((const struct ast_channel_tech *)link->data);
 				else if (link->registered == AST_MODULE_REGISTERED_CLI)
 					res = ast_cli_unregister((struct ast_cli_entry*)link->data);
-				/* Remove linkage */
-				AST_LIST_REMOVE_CURRENT(&mod->links, list);
 				free(link);
 				/* Handle error from unregister process */
 			}



More information about the asterisk-commits mailing list