<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7033">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/33/7033/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 fc56866..8a00ed6 100644<br>--- a/main/format_cap.c<br>+++ b/main/format_cap.c<br>@@ -177,12 +177,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/7033">change 7033</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/7033"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </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: 7033 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>