[Asterisk-code-review] streams: Ensure that stream is closed in ast_stream_and_wait on error (asterisk[master])
Peter Fern
asteriskteam at digium.com
Mon Nov 21 21:44:08 CST 2022
Peter Fern has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19574 )
Change subject: streams: Ensure that stream is closed in ast_stream_and_wait on error
......................................................................
streams: Ensure that stream is closed in ast_stream_and_wait on error
When ast_stream_and_wait returns an error (for example, when attempting
to stream to a channel after hangup) the stream is not closed, and
callers typically do not check the return code. This results in leaking
file descriptors, leading to resource exhaustion.
This change ensures that the stream is closed in case of error.
ASTERISK-30198 #close
Reported-by: Julien Alie
Change-Id: Ie46b67314590ad75154595a3d34d461060b2e803
---
M main/file.c
1 file changed, 22 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/74/19574/1
diff --git a/main/file.c b/main/file.c
index 972f234..10155ed 100644
--- a/main/file.c
+++ b/main/file.c
@@ -1862,6 +1862,9 @@
res = ast_waitstream(chan, digits);
}
}
+ if (res == -1)
+ ast_stopstream(chan);
+
return res;
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19574
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ie46b67314590ad75154595a3d34d461060b2e803
Gerrit-Change-Number: 19574
Gerrit-PatchSet: 1
Gerrit-Owner: Peter Fern <asterisk at obfusc8.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221122/3392bafb/attachment-0001.html>
More information about the asterisk-code-review
mailing list