From: zhengsh Date: Tue, 2 May 2023 19:12:38 +0000 (+0800) Subject: res_sorcery_memory_cache.c: Fix memory leak X-Git-Tag: 20.4.0-rc1~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d1e5f81eeb84979bcdf9a515767fdac39413baa;p=thirdparty%2Fasterisk.git res_sorcery_memory_cache.c: Fix memory leak Replace the original call to ast_strdup with a call to ast_strdupa to fix the leak issue. Resolves: #55 ASTERISK-30429 (cherry picked from commit 8abb29406309c084a904cfd07bd3faac25b1709e) --- diff --git a/res/res_sorcery_memory_cache.c b/res/res_sorcery_memory_cache.c index 6e09dfd877..c3bc7a3bab 100644 --- a/res/res_sorcery_memory_cache.c +++ b/res/res_sorcery_memory_cache.c @@ -1507,7 +1507,7 @@ static int age_cmp(void *a, void *b) */ static void *sorcery_memory_cache_open(const char *data) { - char *options = ast_strdup(data), *option; + char *options = ast_strdupa(data), *option; RAII_VAR(struct sorcery_memory_cache *, cache, NULL, ao2_cleanup); cache = ao2_alloc_options(sizeof(*cache), sorcery_memory_cache_destructor, AO2_ALLOC_OPT_LOCK_NOLOCK);