[FFmpeg-cvslog] smacker demuxer: handle possible av_realloc() failure.
Kostya Shishkov
git at videolan.org
Wed Sep 21 21:08:35 CEST 2011
ffmpeg | branch: release/0.8 | Kostya Shishkov <kostya.shishkov at gmail.com> | Mon Sep 12 09:40:42 2011 +0200| [b1ceca016a498f2629f5cf1faa3d7981ab825f5a] | committer: Michael Niedermayer
smacker demuxer: handle possible av_realloc() failure.
Signed-off-by: Anton Khirnov <anton at khirnov.net>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b1ceca016a498f2629f5cf1faa3d7981ab825f5a
---
libavformat/smacker.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index c22f6da..ad6f265 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -286,15 +286,16 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
for(i = 0; i < 7; i++) {
if(flags & 1) {
int size;
+ uint8_t *tmpbuf;
+
size = avio_rl32(s->pb) - 4;
frame_size -= size;
frame_size -= 4;
smk->curstream++;
- smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size);
- if (!smk->bufs[smk->curstream]) {
- smk->buf_sizes[smk->curstream] = 0;
+ tmpbuf = av_realloc(smk->bufs[smk->curstream], size);
+ if (!tmpbuf)
return AVERROR(ENOMEM);
- }
+ smk->bufs[smk->curstream] = tmpbuf;
smk->buf_sizes[smk->curstream] = size;
ret = avio_read(s->pb, smk->bufs[smk->curstream], size);
if(ret != size)
More information about the ffmpeg-cvslog
mailing list