yop: check return value of avformat_new_stream()
authorPaul B Mahol <onemda@gmail.com>
Fri, 12 Oct 2012 14:23:01 +0000 (14:23 +0000)
committerPaul B Mahol <onemda@gmail.com>
Fri, 12 Oct 2012 14:25:00 +0000 (14:25 +0000)
Fixes null pointer dereference, fixes CID703729.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavformat/yop.c

index 1185a3e..2d89c6e 100644 (file)
@@ -64,6 +64,8 @@ static int yop_read_header(AVFormatContext *s)
 
     audio_stream = avformat_new_stream(s, NULL);
     video_stream = avformat_new_stream(s, NULL);
+    if (!audio_stream || !video_stream)
+        return AVERROR(ENOMEM);
 
     // Extra data that will be passed to the decoder
     video_stream->codec->extradata_size = 8;