diff --git a/main/format.c b/main/format.c index cea89a2b6a..d04eb054d1 100644 --- a/main/format.c +++ b/main/format.c @@ -916,7 +916,7 @@ int init_framer(void) static int format_list_add_custom(struct ast_format_list *new) { - struct ast_format_list *entry; + RAII_VAR(struct ast_format_list *, entry, NULL, ao2_cleanup); if (!(entry = ao2_alloc(sizeof(*entry), NULL))) { return -1; } diff --git a/main/loader.c b/main/loader.c index 7ad515f8aa..a0bec43eb4 100644 --- a/main/loader.c +++ b/main/loader.c @@ -1035,6 +1035,8 @@ static int load_resource_list(struct load_order *load_order, unsigned int global break; case AST_MODULE_LOAD_PRIORITY: AST_LIST_REMOVE_CURRENT(entry); + ast_free(order->resource); + ast_free(order); break; } }