res_sorcery_memory_cache.c: Fix memory leak (#56)

Replace the original call to ast_strdup with a call to ast_strdupa to fix the leak issue.

Resolves: #55
ASTERISK-30429
This commit is contained in:
zhengsh 2023-05-12 04:21:57 +08:00 committed by GitHub
parent f414815159
commit c8ce2c705d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View 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);