From f817526226cc2a594058c92a00da060922d671cb Mon Sep 17 00:00:00 2001 From: Spiridonov Dmitry Date: Sun, 14 Apr 2024 15:41:47 +0300 Subject: [PATCH] sorcery.c: Fixed crash error when executing "module reload" Fixed crash error when cli "module reload". The error appears when compiling with res_prometheus and using the sorcery memory cache for registrations (cherry picked from commit 5a883f5410d5dfc2f2002df4d8764ed615f43c36) --- main/sorcery.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/sorcery.c b/main/sorcery.c index 39396fefb5..06a458ab0b 100644 --- a/main/sorcery.c +++ b/main/sorcery.c @@ -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); -- 2.47.2