<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/5845">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">channel: Fix reference counting in ast_channel_suppress.<br><br>The ast_channel_suppress function wrongly decremented the<br>reference count of the underlying structure used to keep<br>track of what should be suppressed on a channel if the<br>function was called multiple times on the same channel.<br><br>This change cleans up the reference counting a bit so<br>this no longer occurs.<br><br>ASTERISK-27016<br><br>Change-Id: I2eed4077cb4916e6626f9f120b63b963acc5c136<br>---<br>M main/channel.c<br>1 file changed, 4 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/45/5845/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/channel.c b/main/channel.c<br>index 58f960a..1ca485e 100644<br>--- a/main/channel.c<br>+++ b/main/channel.c<br>@@ -10744,7 +10744,7 @@<br> <br> int ast_channel_suppress(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype)<br> {<br>-      RAII_VAR(struct suppress_data *, suppress, NULL, ao2_cleanup);<br>+       struct suppress_data *suppress;<br>       const struct ast_datastore_info *datastore_info = NULL;<br>       struct ast_datastore *datastore = NULL;<br>       struct ast_framehook_interface interface = {<br>@@ -10780,6 +10780,7 @@<br>         if (framehook_id < 0) {<br>            /* Hook attach failed.  Get rid of the evidence. */<br>           ast_log(LOG_WARNING, "Failed to attach framehook while attempting to suppress a stream.\n");<br>+               ao2_ref(suppress, -1);<br>                return -1;<br>    }<br> <br>@@ -10791,11 +10792,11 @@<br>       if (!(datastore = ast_datastore_alloc(datastore_info, NULL))) {<br>               ast_log(LOG_WARNING, "Failed to allocate datastore while attempting to suppress a stream.\n");<br>              ast_framehook_detach(chan, framehook_id);<br>+            ao2_ref(suppress, -1);<br>                return -1;<br>    }<br> <br>- /* and another ref for the datastore */<br>-      ao2_ref(suppress, +1);<br>+       /* the ref provided by the allocation is taken by the datastore */<br>    datastore->data = suppress;<br> <br>     ast_channel_datastore_add(chan, datastore);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/5845">change 5845</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/5845"/><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-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I2eed4077cb4916e6626f9f120b63b963acc5c136 </div>
<div style="display:none"> Gerrit-Change-Number: 5845 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>