[asterisk-commits] mmichelson: trunk r411296 - in /trunk: ./ main/sorcery.c

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


Author: mmichelson
Date: Thu Mar 27 09:21:15 2014
New Revision: 411296

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

Merged revisions 411295 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/sorcery.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/main/sorcery.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/sorcery.c?view=diff&rev=411296&r1=411295&r2=411296
==============================================================================
--- trunk/main/sorcery.c (original)
+++ trunk/main/sorcery.c Thu Mar 27 09:21:15 2014
@@ -680,6 +680,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 */
@@ -707,7 +709,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