From 0ab4e7491d3b107f3a6092e3bd14080f043f1caa Mon Sep 17 00:00:00 2001
From: Jean Aunis <jean.aunis@prescom.fr>
Date: Wed, 29 Sep 2021 11:32:23 +0200
Subject: [PATCH] res_rtp_asterisk: fix memory leak

Add missing reference decrement in rtp_deallocate_transport()

ASTERISK-29671

Change-Id: I8d22dbedb90e8dade0829b7a28372f404b07caa9
---
 res/res_rtp_asterisk.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 8ede400da8..7b236becd4 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -3994,6 +3994,11 @@ static void rtp_deallocate_transport(struct ast_rtp_instance *instance, struct a
 		rtp->ice_active_remote_candidates = NULL;
 	}
 
+	if (rtp->ice_proposed_remote_candidates) {
+		ao2_ref(rtp->ice_proposed_remote_candidates, -1);
+		rtp->ice_proposed_remote_candidates = NULL;
+	}
+
 	if (rtp->ioqueue) {
 		/*
 		 * We cannot hold the instance lock because we could wait
-- 
GitLab