]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
ari: Destroy body variables in channel create.
authorJoshua C. Colp <jcolp@sangoma.com>
Thu, 8 Dec 2022 10:33:02 +0000 (06:33 -0400)
committerGeorge Joseph <gjoseph@digium.com>
Fri, 9 Dec 2022 12:48:54 +0000 (06:48 -0600)
When passing a JSON body to the 'create' channel route
it would be converted into Asterisk variables, but never
freed resulting in a memory leak.

This change makes it so that the variables are freed in
all cases.

ASTERISK-30344

Change-Id: I924dbd866a01c6073e2d6fb846ccaa27ef72d49d

res/ari/resource_channels.c

index 71c4a14489fc3016855dfa4bc1f8ae659254f78c..9ee4a46e0b1b96a49ac3585d17087eff9bf57b87 100644 (file)
@@ -1779,7 +1779,7 @@ void ast_ari_channels_create(struct ast_variable *headers,
        struct ast_ari_channels_create_args *args,
        struct ast_ari_response *response)
 {
-       struct ast_variable *variables = NULL;
+       RAII_VAR(struct ast_variable *, variables, NULL, ast_variables_destroy);
        struct ast_assigned_ids assignedids;
        struct ari_channel_thread_data *chan_data;
        struct ast_channel_snapshot *snapshot;