From db172991f6e03e5a2cde40b8d0feb803568c5190 Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Fri, 21 Aug 2026 18:14:17 +0000 Subject: [PATCH] res_geolocation: Don't crash on invalid sorcery configuration A crash will occur when you've configured object mappings using the realtime wizard but neglect to set up your realtime configuration in `extconfig.conf`. For example, adding the following to `sorcery.conf`: [res_geolocation] location = realtime,geo_location profile = realtime,geo_profile But not defining `geo_location` or `geo_profile` in `extconfig.conf` will cause Asterisk to crash on startup. --- res/res_geolocation/geoloc_config.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/res/res_geolocation/geoloc_config.c b/res/res_geolocation/geoloc_config.c index 328f36ba81..2afc8bda2d 100644 --- a/res/res_geolocation/geoloc_config.c +++ b/res/res_geolocation/geoloc_config.c @@ -611,13 +611,12 @@ int geoloc_config_unload(void) { ast_cli_unregister_multiple(geoloc_location_cli_commands, ARRAY_LEN(geoloc_location_cli_commands)); - ast_sorcery_object_unregister(geoloc_sorcery, "profile"); - ast_sorcery_object_unregister(geoloc_sorcery, "location"); - if (geoloc_sorcery) { + ast_sorcery_object_unregister(geoloc_sorcery, "profile"); + ast_sorcery_object_unregister(geoloc_sorcery, "location"); ast_sorcery_unref(geoloc_sorcery); + geoloc_sorcery = NULL; } - geoloc_sorcery = NULL; return 0; }