From 95c48153421b1a6e0d7ca6cf5e67cd7623c03dc7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 16 Apr 2020 14:16:42 +0200 Subject: Some missing checks for allocation failures. --- src/lib/ffmpeg.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/lib') diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index 8dc525db9..8eb19816c 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -116,7 +116,13 @@ FFmpeg::setup_general () _file_group.set_paths (_ffmpeg_content->paths ()); _avio_buffer = static_cast (wrapped_av_malloc (_avio_buffer_size)); _avio_context = avio_alloc_context (_avio_buffer, _avio_buffer_size, 0, this, avio_read_wrapper, 0, avio_seek_wrapper); + if (!_avio_context) { + throw std::bad_alloc (); + } _format_context = avformat_alloc_context (); + if (!_format_context) { + throw std::bad_alloc (); + } _format_context->pb = _avio_context; AVDictionary* options = 0; -- cgit v1.2.3