diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2011-09-12 09:40:42 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-09-12 15:51:21 +0200 |
commit | 47a8589f7bc69d1a29da1dfdfbd0dfa78a9e31fd (patch) | |
tree | 18b250172e8488ff7b914cecadb16eb6c17ee8db /libavformat/smacker.c | |
parent | 615baa13e4a757776681a07432a58edad09b9333 (diff) | |
download | ffmpeg-47a8589f7bc69d1a29da1dfdfbd0dfa78a9e31fd.tar.gz |
smacker demuxer: handle possible av_realloc() failure.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat/smacker.c')
-rw-r--r-- | libavformat/smacker.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 51a3b1b8b8..274946696c 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -286,11 +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); + 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) |