From: George Joseph Date: Thu, 18 Dec 2014 00:11:24 +0000 (+0000) Subject: res_pjsip_config_wizard: fix unload SEGV X-Git-Tag: 14.0.0-beta1~1382 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18b5a336ef8e63233e80f4c86ac556fd2867dec1;p=thirdparty%2Fasterisk.git res_pjsip_config_wizard: fix unload SEGV If certain pjsip modules aren't loaded, the wizard causes a SEGV when it unloads. Added a check for the presense of the object type wizard before trying to clean it up. Tested-by: George Joseph ........ Merged revisions 429719 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429720 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_pjsip_config_wizard.c b/res/res_pjsip_config_wizard.c index 86187ee3f8..a7f2803d17 100644 --- a/res/res_pjsip_config_wizard.c +++ b/res/res_pjsip_config_wizard.c @@ -983,12 +983,13 @@ static int unload_module(void) ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, NULL, NULL), ao2_cleanup); otw = find_wizard(object_types[i]); - if (otw->sorcery) { - ast_sorcery_instance_observer_remove(otw->sorcery, &observer); + if (otw) { + if (otw->sorcery) { + ast_sorcery_instance_observer_remove(otw->sorcery, &observer); + } + otw->wizard->retrieve_multiple(otw->sorcery, otw->wizard_data, object_types[i], existing, NULL); + ao2_callback(existing, OBJ_NODATA | OBJ_UNLINK | OBJ_MULTIPLE, delete_existing_cb, otw); } - - otw->wizard->retrieve_multiple(otw->sorcery, otw->wizard_data, object_types[i], existing, NULL); - ao2_callback(existing, OBJ_NODATA | OBJ_UNLINK | OBJ_MULTIPLE, delete_existing_cb, otw); } AST_VECTOR_REMOVE_CMP_UNORDERED(&object_type_wizards, NULL, NOT_EQUALS, OTW_DELETE_CB);