[asterisk-commits] mmichelson: branch 12 r411295 - /branches/12/main/sorcery.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 27 09:20:26 CDT 2014


Author: mmichelson
Date: Thu Mar 27 09:20:10 2014
New Revision: 411295

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411295
Log:
Give sorcery instances a reference to their wizards.

On graceful shutdown, sorcery wizards are all killed off, but it is
possible for sorcery instances to still have dangling pointers after
this, possibly causing a crash. Giving the sorcery instances a reference
to their wizards ensures that the wizard reference will remain valid for
the lifetime of the sorcery instance.

Review: https://reviewboard.asterisk.org/r/3401


Modified:
    branches/12/main/sorcery.c

Modified: branches/12/main/sorcery.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/sorcery.c?view=diff&rev=411295&r1=411294&r2=411295
==============================================================================
--- branches/12/main/sorcery.c (original)
+++ branches/12/main/sorcery.c Thu Mar 27 09:20:10 2014
@@ -688,6 +688,8 @@
 	if (object_wizard->wizard) {
 		ast_module_unref(object_wizard->wizard->module);
 	}
+
+	ao2_cleanup(object_wizard->wizard);
 }
 
 /*! \brief Internal function which creates an object type and adds a wizard mapping */
@@ -728,7 +730,7 @@
 
 	ast_module_ref(wizard->module);
 
-	object_wizard->wizard = wizard;
+	object_wizard->wizard = ao2_bump(wizard);
 	object_wizard->caching = caching;
 
 	ao2_link(object_type->wizards, object_wizard);




More information about the asterisk-commits mailing list