<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9035">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">channel.c: Fix off nominal channel allocation failure path.<br><br>__ast_channel_alloc_ap() had a failure exit path that hadn't setup the fd<br>descriptors to -1 yet. The destructor would then attempt to close these<br>fd's that had never been opened.<br><br>Change-Id: Icf21093f36c60781e8cf6ee9d586536302af33e3<br>---<br>M main/channel.c<br>1 file changed, 10 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/35/9035/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/channel.c b/main/channel.c<br>index 861166f..4475d24 100644<br>--- a/main/channel.c<br>+++ b/main/channel.c<br>@@ -813,7 +813,16 @@<br> <br> ast_channel_stage_snapshot(tmp);<br> <br>- if (!(nativeformats = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {<br>+ /*<br>+ * Init file descriptors to unopened state so<br>+ * the destructor can know not to close them.<br>+ */<br>+ ast_channel_timingfd_set(tmp, -1);<br>+ ast_channel_internal_alertpipe_clear(tmp);<br>+ ast_channel_internal_fd_clear_all(tmp);<br>+<br>+ nativeformats = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);<br>+ if (!nativeformats) {<br> /*<br> * Aborting the channel creation. We do not need to complete staging<br> * the channel snapshot because the channel has not been finalized or<br>@@ -830,14 +839,6 @@<br> ast_channel_set_rawreadformat(tmp, ast_format_none);<br> ast_channel_set_writeformat(tmp, ast_format_none);<br> ast_channel_set_readformat(tmp, ast_format_none);<br>-<br>- /*<br>- * Init file descriptors to unopened state so<br>- * the destructor can know not to close them.<br>- */<br>- ast_channel_timingfd_set(tmp, -1);<br>- ast_channel_internal_alertpipe_clear(tmp);<br>- ast_channel_internal_fd_clear_all(tmp);<br> <br> if (!(schedctx = ast_sched_context_create())) {<br> ast_log(LOG_WARNING, "Channel allocation failed: Unable to create schedule context\n");<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9035">change 9035</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/9035"/><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: Icf21093f36c60781e8cf6ee9d586536302af33e3 </div>
<div style="display:none"> Gerrit-Change-Number: 9035 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>