summaryrefslogtreecommitdiff
path: root/libavformat/yop.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-05-03 10:48:03 +0200
committerAnton Khirnov <anton@khirnov.net>2014-05-18 10:22:42 +0200
commitab3fdaa7131e2fd8e33006daea25a282724c01f0 (patch)
treeacda4a15ceb33bbe979c20f9ca60c83026ce7d0b /libavformat/yop.c
parentb513bf6f69e26e724de6d5dca642c3582dcd0517 (diff)
yop: only set extradata size after it has been successfully allocated
Do not leave a non-zero extradata_size set on failure
Diffstat (limited to 'libavformat/yop.c')
-rw-r--r--libavformat/yop.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavformat/yop.c b/libavformat/yop.c
index 8caeb07157..ea3175e33b 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -62,13 +62,12 @@ static int yop_read_header(AVFormatContext *s)
video_stream = avformat_new_stream(s, NULL);
// Extra data that will be passed to the decoder
- video_stream->codec->extradata_size = 8;
- video_stream->codec->extradata = av_mallocz(video_stream->codec->extradata_size +
- FF_INPUT_BUFFER_PADDING_SIZE);
+ video_stream->codec->extradata = av_mallocz(8 + FF_INPUT_BUFFER_PADDING_SIZE);
if (!video_stream->codec->extradata)
return AVERROR(ENOMEM);
+ video_stream->codec->extradata_size = 8;
// Audio
audio_dec = audio_stream->codec;