mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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
This commit is contained in:
committed by
George Joseph
parent
36bea9ad33
commit
58404b5c22
@@ -1862,6 +1862,10 @@ int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *
|
||||
res = ast_waitstream(chan, digits);
|
||||
}
|
||||
}
|
||||
if (res == -1) {
|
||||
ast_stopstream(chan);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user