<p>Jaco Kroon has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15600">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">format_cap: fix reference leak.<br><br>format_cap_framed_init decrements the reference count on<br>format_cap_framed object in all failure paths, and increments it on<br>success path.<br><br>This is inconsistent in that the caller retains a ref on success, but<br>sacrifices the ref on failure.<br><br>Make it consistent such that format_cap_framed_init always takes over<br>the ref and the caller thus needs to +1 it before passing if it would<br>like to retain a reference.<br><br>The only user I can find is __ast_format_cap_append which already<br>assumes the new behaviour.<br><br>Change-Id: Ib09076f065421c02aab8f7d6716c07344277103b<br>Signed-off-by: Jaco Kroon <jaco@uls.co.za><br>---<br>M main/format_cap.c<br>1 file changed, 1 insertion(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/00/15600/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/format_cap.c b/main/format_cap.c</span><br><span>index 4dc8e49..467f182 100644</span><br><span>--- a/main/format_cap.c</span><br><span>+++ b/main/format_cap.c</span><br><span>@@ -167,7 +167,7 @@</span><br><span>     }</span><br><span> </span><br><span>        /* Order doesn't matter for formats, so insert at the head for performance reasons */</span><br><span style="color: hsl(0, 100%, 40%);">-       ao2_ref(framed, +1);</span><br><span style="color: hsl(120, 100%, 40%);">+  /* No need to ao2_ref(+1) as we take the ref from the constructor */</span><br><span>         AST_LIST_INSERT_HEAD(list, framed, entry);</span><br><span> </span><br><span>       cap->framing = MIN(cap->framing, framing ? framing : ast_format_get_default_ms(format));</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15600">change 15600</a>. To unsubscribe, or for help writing mail filters, 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/c/asterisk/+/15600"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ib09076f065421c02aab8f7d6716c07344277103b </div>
<div style="display:none"> Gerrit-Change-Number: 15600 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Jaco Kroon <jaco@uls.co.za> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>