[Asterisk-code-review] res pjsip session: Check for errors from ast stream topology... (asterisk[15])

Corey Farrell asteriskteam at digium.com
Tue Nov 7 11:41:03 CST 2017


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7104


Change subject: res_pjsip_session: Check for errors from ast_stream_topology_set_stream.
......................................................................

res_pjsip_session: Check for errors from ast_stream_topology_set_stream.

Free memory and return error if ast_stream_topology_set_stream fails.

Change-Id: I9f4dbf44bed627243d2f1dd8aea2eab6c38a028d
---
M res/res_pjsip_session.c
1 file changed, 8 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/04/7104/1

diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 4724d46..b0cb6c0 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -678,7 +678,10 @@
 			if (!stream) {
 				return -1;
 			}
-			ast_stream_topology_set_stream(session->pending_media_state->topology, i, stream);
+			if (ast_stream_topology_set_stream(session->pending_media_state->topology, i, stream)) {
+				ast_stream_free(stream);
+				return -1;
+			}
 		}
 
 		session_media = ast_sip_session_media_state_add(session, session->pending_media_state, ast_media_type_from_str(media), i);
@@ -1745,7 +1748,10 @@
 		/* As this is only called on an incoming SDP offer before processing it is not possible
 		 * for streams and their media sessions to exist.
 		 */
-		ast_stream_topology_set_stream(session->pending_media_state->topology, i, stream);
+		if (ast_stream_topology_set_stream(session->pending_media_state->topology, i, stream)) {
+			ast_stream_free(stream);
+			return -1;
+		}
 
 		session_media = ast_sip_session_media_state_add(session, session->pending_media_state, ast_media_type_from_str(media), i);
 		if (!session_media) {

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f4dbf44bed627243d2f1dd8aea2eab6c38a028d
Gerrit-Change-Number: 7104
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171107/9bde356b/attachment.html>


More information about the asterisk-code-review mailing list