summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-11-07 12:40:08 -0500
committerCorey Farrell <git@cfware.com>2017-11-07 12:41:02 -0500
commit17136aacc019ae8729bb688d1e06aa6ca992d1c6 (patch)
tree8ff317689a78bc9a35811059ffc6fd0229c6eba1
parent7fc3399d6d8a18da4522331fd7650228a2fe7a3f (diff)
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
-rw-r--r--res/res_pjsip_session.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 4724d46ce..b0cb6c0a0 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -678,7 +678,10 @@ static int handle_incoming_sdp(struct ast_sip_session *session, const pjmedia_sd
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 @@ static int sdp_requires_deferral(struct ast_sip_session *session, const pjmedia_
/* 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) {