[Asterisk-code-review] SDP: Remove sdp state.remote capabilities (asterisk[master])

George Joseph asteriskteam at digium.com
Fri May 12 12:29:15 CDT 2017


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/5595 )

Change subject: SDP: Remove sdp_state.remote_capabilities
......................................................................


SDP: Remove sdp_state.remote_capabilities

The sdp_state.remote_capabilities was only used inside merge_sdps() and
subsequent calls to merge_sdps() by re-INVITE's would leak them.

Change-Id: I0ceb7838ea044cc913e8ad4a255c39c9740ae0ce
---
M main/sdp_state.c
1 file changed, 6 insertions(+), 10 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Jenkins2: Approved for Submit
  Joshua Colp: Approved for Submit



diff --git a/main/sdp_state.c b/main/sdp_state.c
index 0da93e4..a9979eb 100644
--- a/main/sdp_state.c
+++ b/main/sdp_state.c
@@ -340,9 +340,7 @@
 	struct sdp_state_capabilities *negotiated_capabilities;
 	/*! Proposed capabilities */
 	struct sdp_state_capabilities *proposed_capabilities;
-	/*! Remote capabilities, learned through remote SDP */
-	struct ast_stream_topology *remote_capabilities;
-	/*! Local SDP. Generated via the options and local capabilities. */
+	/*! Local SDP. Generated via the options and currently negotiated/proposed capabilities. */
 	struct ast_sdp *local_sdp;
 	/*! SDP options. Configured options beyond media capabilities. */
 	struct ast_sdp_options *options;
@@ -389,7 +387,6 @@
 
 	sdp_state_capabilities_free(sdp_state->negotiated_capabilities);
 	sdp_state_capabilities_free(sdp_state->proposed_capabilities);
-	ast_stream_topology_free(sdp_state->remote_capabilities);
 	ast_sdp_free(sdp_state->local_sdp);
 	ast_sdp_options_free(sdp_state->options);
 	ast_sdp_translator_free(sdp_state->translator);
@@ -1007,15 +1004,17 @@
 static int merge_sdps(struct ast_sdp_state *sdp_state, const struct ast_sdp *remote_sdp)
 {
 	struct sdp_state_capabilities *joint_capabilities;
+	struct ast_stream_topology *remote_capabilities;
 	int i;
 
-	sdp_state->remote_capabilities = ast_get_topology_from_sdp(remote_sdp);
-	if (!sdp_state->remote_capabilities) {
+	remote_capabilities = ast_get_topology_from_sdp(remote_sdp);
+	if (!remote_capabilities) {
 		return -1;
 	}
 
 	joint_capabilities = merge_capabilities(sdp_state->proposed_capabilities,
-		sdp_state->remote_capabilities, sdp_state->options, 0);
+		remote_capabilities, sdp_state->options, 0);
+	ast_stream_topology_free(remote_capabilities);
 	if (!joint_capabilities) {
 		return -1;
 	}
@@ -1113,9 +1112,6 @@
 
 	ast_sdp_free(sdp_state->local_sdp);
 	sdp_state->local_sdp = NULL;
-
-	ast_stream_topology_free(sdp_state->remote_capabilities);
-	sdp_state->remote_capabilities = NULL;
 
 	set_proposed_capabilities(sdp_state, NULL);
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0ceb7838ea044cc913e8ad4a255c39c9740ae0ce
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list