]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_sorcery_memory_cache.c: Fix memory leak
authorzhengsh <zhengsh@ti-net.com.cn>
Tue, 2 May 2023 19:12:38 +0000 (03:12 +0800)
committerAsterisk Development Team <asteriskteam@digium.com>
Mon, 10 Jul 2023 11:49:30 +0000 (11:49 +0000)
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 5e16557127fb5e60a6d6b43357afcf663d1751d6)

res/res_sorcery_memory_cache.c

index 6e09dfd8771cb0130e0c4730a1555fdad06ad92a..c3bc7a3bab72154da8678c04fceffef5507ff840 100644 (file)
@@ -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);