main/refer.c: Fix double free in refer_data_destructor + potential leak

Resolves: #267
This commit is contained in:
Maximilian Fridrich 2023-08-21 18:28:42 +02:00
parent 333858fb70
commit 0950d116af
1 changed files with 1 additions and 1 deletions

View File

@ -109,7 +109,6 @@ static void refer_data_destructor(void *obj)
{ {
struct refer_data *data = obj; struct refer_data *data = obj;
ast_free(data->value); ast_free(data->value);
ast_free(data);
} }
static void refer_destructor(void *obj) static void refer_destructor(void *obj)
@ -298,6 +297,7 @@ static int refer_set_var_full(struct ast_refer *refer, const char *name, const c
if (ast_strlen_zero(value)) { if (ast_strlen_zero(value)) {
ao2_unlink(refer->vars, data); ao2_unlink(refer->vars, data);
} else { } else {
ast_free(data->value);
data->value = ast_strdup(value); data->value = ast_strdup(value);
} }
} }