[Asterisk-code-review] res ari channels: Fix reference leak in channel state invalid. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Wed Nov 1 07:42:09 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/6945 )

Change subject: res_ari_channels: Fix reference leak in channel_state_invalid.
......................................................................

res_ari_channels: Fix reference leak in channel_state_invalid.

channel_state_invalid leaked a reference to the channel snapshot any
time it was aquired.

ASTERISK-27067 #close

Change-Id: I8c653f00416b39978513c5605c4be0f03b1df29a
---
M res/ari/resource_channels.c
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  George Joseph: Looks good to me, approved



diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 6027a80..6b4f26c 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -99,9 +99,13 @@
 		|| snapshot->state == AST_STATE_RINGING) {
 		ast_ari_response_error(response, 412, "Precondition Failed",
 			"Channel in invalid state");
+		ao2_ref(snapshot, -1);
+
 		return -1;
 	}
 
+	ao2_ref(snapshot, -1);
+
 	return 0;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/6945
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8c653f00416b39978513c5605c4be0f03b1df29a
Gerrit-Change-Number: 6945
Gerrit-PatchSet: 2
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171101/a879acbb/attachment.html>


More information about the asterisk-code-review mailing list