From 7fb2f15a1aa0328e1a31934c2e3822e5228535a4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 29 Jul 2016 19:16:47 +0200 Subject: [PATCH] decoder/ffmpeg: check avformat_open_input() return value --- src/decoder/plugins/FfmpegDecoderPlugin.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index 533799548..0b85122f0 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -69,7 +69,13 @@ FfmpegOpenInput(AVIOContext *pb, context->pb = pb; - avformat_open_input(&context, filename, fmt, nullptr); + int err = avformat_open_input(&context, filename, fmt, nullptr); + if (err < 0) { + avformat_free_context(context); + SetFfmpegError(error, err, "avformat_open_input() failed"); + return nullptr; + } + return context; }