[FFmpeg-cvslog] aviobuf: Handle a NULL buffer in avio_close_dyn_buf
Martin Storsjö
git at videolan.org
Fri Nov 1 19:33:22 CET 2013
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed Oct 30 19:09:30 2013 +0200| [d07b51bf0733fe58bbfa13c448775dc325463cb4] | committer: Martin Storsjö
aviobuf: Handle a NULL buffer in avio_close_dyn_buf
This simplifies proper error handling in rtsp.c/rtspdec.c. When
broadcasting over RTSP in TCP mode, the AVIOContext is closed and
recreated for each sent packet, and if the recreation fails, we might
try to close a NULL buffer when freeing things at the end.
Previously, if recreating the buffer in rtspdec.c failed, this would
crash later due to trying to close a NULL buffer.
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d07b51bf0733fe58bbfa13c448775dc325463cb4
---
libavformat/aviobuf.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 5064eb8..0024f9e 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -964,6 +964,11 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
static const char padbuf[FF_INPUT_BUFFER_PADDING_SIZE] = {0};
int padding = 0;
+ if (!s) {
+ *pbuffer = NULL;
+ return 0;
+ }
+
/* don't attempt to pad fixed-size packet buffers */
if (!s->max_packet_size) {
avio_write(s, padbuf, sizeof(padbuf));
More information about the ffmpeg-cvslog
mailing list