]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
sorcery.c: Fixed crash error when executing "module reload"
authorSpiridonov Dmitry <spiridonovd@ringoline.ru>
Sun, 14 Apr 2024 12:41:47 +0000 (15:41 +0300)
committerSpiridonov Dmitry <spiridonovd@ringoline.ru>
Mon, 22 Apr 2024 12:55:42 +0000 (12:55 +0000)
Fixed crash error when cli "module reload". The error appears when
compiling with res_prometheus and using the sorcery memory cache for
registrations

main/sorcery.c

index 39396fefb5828bfbefc3b09bebab52bc1724b8b7..06a458ab0b3e7640c07c81e2ccacfe155a3f847f 100644 (file)
@@ -1939,7 +1939,12 @@ void *ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const ch
 
        /* If we are returning a single object and it came from a non-cache source create it in any caches */
        if (!(flags & AST_RETRIEVE_FLAG_MULTIPLE) && !cached && object) {
-               AST_VECTOR_CALLBACK(&object_type->wizards, sorcery_cache_create, NULL, object, 0);
+               struct sorcery_details sdetails = {
+                       .sorcery = sorcery,
+                       .obj = object,
+               };
+
+               AST_VECTOR_CALLBACK(&object_type->wizards, sorcery_cache_create, NULL, &sdetails, 0);
        }
        AST_VECTOR_RW_UNLOCK(&object_type->wizards);