<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7032">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">format_cap: Fix leak on AST_VECTOR_APPEND error.<br><br>format_cap_framed_init can fail on AST_VECTOR_APPEND.  This should<br>report failure to the caller and clean the newly allocated frame.<br><br>Change-Id: Ica0661235bf09497bf23d844ceb01f21b41a55b0<br>---<br>M main/format_cap.c<br>1 file changed, 6 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/32/7032/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/format_cap.c b/main/format_cap.c<br>index b0897c0..d71ccdb 100644<br>--- a/main/format_cap.c<br>+++ b/main/format_cap.c<br>@@ -160,12 +160,15 @@<br>     }<br>     list = AST_VECTOR_GET_ADDR(&cap->formats, ast_format_get_codec_id(format));<br> <br>+        /* This takes the allocation reference */<br>+    if (AST_VECTOR_APPEND(&cap->preference_order, framed)) {<br>+              ao2_ref(framed, -1);<br>+         return -1;<br>+   }<br>+<br>  /* Order doesn't matter for formats, so insert at the head for performance reasons */<br>     ao2_ref(framed, +1);<br>  AST_LIST_INSERT_HEAD(list, framed, entry);<br>-<br>-        /* This takes the allocation reference */<br>-    AST_VECTOR_APPEND(&cap->preference_order, framed);<br> <br>  cap->framing = MIN(cap->framing, framing ? framing : ast_format_get_default_ms(format));<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7032">change 7032</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/7032"/><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: Ica0661235bf09497bf23d844ceb01f21b41a55b0 </div>
<div style="display:none"> Gerrit-Change-Number: 7032 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>