summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorAlexandra Khirnova <alexandra.khirnova@gmail.com>2013-09-18 18:12:36 +0200
committerDiego Biurrun <diego@biurrun.de>2013-09-18 18:28:38 +0200
commit5626f994f273af80fb100d4743b963304de9e05c (patch)
tree69a48a5383a83d06f8e25df3098cce219788e873 /libavformat/mov.c
parent0f310a6f333b016d336674d086045e8473fdf918 (diff)
avformat: Use av_reallocp() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 77ba4441fb..a84fae84ba 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -878,6 +878,7 @@ static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVStream *st;
uint64_t size;
uint8_t *buf;
+ int err;
if (c->fc->nb_streams < 1) // will happen with jp2 files
return 0;
@@ -885,11 +886,9 @@ static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom)
size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;
if (size > INT_MAX || (uint64_t)atom.size > INT_MAX)
return AVERROR_INVALIDDATA;
- buf= av_realloc(st->codec->extradata, size);
- if (!buf)
- return AVERROR(ENOMEM);
- st->codec->extradata= buf;
- buf+= st->codec->extradata_size;
+ if ((err = av_reallocp(&st->codec->extradata, size)) < 0)
+ return err;
+ buf = st->codec->extradata + st->codec->extradata_size;
st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE;
AV_WB32( buf , atom.size + 8);
AV_WL32( buf + 4, atom.type);