[Asterisk-code-review] ari: Destroy body variables in channel create. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Thu Dec 8 04:36:50 CST 2022


Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19671 )


Change subject: ari: Destroy body variables in channel create.
......................................................................

ari: Destroy body variables in channel create.

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
---
M res/ari/resource_channels.c
1 file changed, 19 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/71/19671/1

diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 71c4a14..9ee4a46 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -1779,7 +1779,7 @@
 	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;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19671
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I924dbd866a01c6073e2d6fb846ccaa27ef72d49d
Gerrit-Change-Number: 19671
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221208/29916b04/attachment.html>


More information about the asterisk-code-review mailing list