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

Friendly Automation asteriskteam at digium.com
Thu Dec 8 11:22:51 CST 2022


Friendly Automation has submitted this change. ( 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(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit




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: 2
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221208/5517410a/attachment-0001.html>


More information about the asterisk-code-review mailing list