<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7102">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_t38: Better error checking for t38_create_media_state.<br><br>Change-Id: I81b2587427c6982aa3e2a3f9ad69cce8d316eb10<br>---<br>M res/res_pjsip_t38.c<br>1 file changed, 11 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/02/7102/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c<br>index 48cbab3..8f1905f 100644<br>--- a/res/res_pjsip_t38.c<br>+++ b/res/res_pjsip_t38.c<br>@@ -363,7 +363,11 @@<br> }<br> <br> ast_stream_set_state(stream, AST_STREAM_STATE_SENDRECV);<br>- ast_stream_topology_set_stream(media_state->topology, 0, stream);<br>+ if (ast_stream_topology_set_stream(media_state->topology, 0, stream)) {<br>+ ast_stream_free(stream);<br>+ ast_sip_session_media_state_free(media_state);<br>+ return NULL;<br>+ }<br> <br> caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);<br> if (!caps) {<br>@@ -371,9 +375,14 @@<br> return NULL;<br> }<br> <br>- ast_format_cap_append(caps, ast_format_t38, 0);<br> ast_stream_set_formats(stream, caps);<br>+ /* stream holds a reference to cap, release the local reference<br>+ * now so we don't have to deal with it in the error condition. */<br> ao2_ref(caps, -1);<br>+ if (ast_format_cap_append(caps, ast_format_t38, 0)) {<br>+ ast_sip_session_media_state_free(media_state);<br>+ return NULL;<br>+ }<br> <br> session_media = ast_sip_session_media_state_add(session, media_state, AST_MEDIA_TYPE_IMAGE, 0);<br> if (!session_media) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7102">change 7102</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7102"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I81b2587427c6982aa3e2a3f9ad69cce8d316eb10 </div>
<div style="display:none"> Gerrit-Change-Number: 7102 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>