<p>Peter Fern has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19574">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">streams: Ensure that stream is closed in ast_stream_and_wait on error<br><br>When ast_stream_and_wait returns an error (for example, when attempting<br>to stream to a channel after hangup) the stream is not closed, and<br>callers typically do not check the return code. This results in leaking<br>file descriptors, leading to resource exhaustion.<br><br>This change ensures that the stream is closed in case of error.<br><br>ASTERISK-30198 #close<br>Reported-by: Julien Alie<br><br>Change-Id: Ie46b67314590ad75154595a3d34d461060b2e803<br>---<br>M main/file.c<br>1 file changed, 22 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/74/19574/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/file.c b/main/file.c</span><br><span>index 972f234..10155ed 100644</span><br><span>--- a/main/file.c</span><br><span>+++ b/main/file.c</span><br><span>@@ -1862,6 +1862,9 @@</span><br><span> res = ast_waitstream(chan, digits);</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (res == -1)</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_stopstream(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> return res;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19574">change 19574</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/+/19574"/><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: Ie46b67314590ad75154595a3d34d461060b2e803 </div>
<div style="display:none"> Gerrit-Change-Number: 19574 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Peter Fern <asterisk@obfusc8.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>