summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-04-16 14:16:42 +0200
committerCarl Hetherington <cth@carlh.net>2020-04-16 14:16:42 +0200
commit95c48153421b1a6e0d7ca6cf5e67cd7623c03dc7 (patch)
treeabec48e7710dc65611db40d42a1d03e22c7b7ae4 /src/lib
parent4219d4b76c5cd5690b1f4fa0c248d93ced26d05a (diff)
Some missing checks for allocation failures.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ffmpeg.cc6
1 files changed, 6 insertions, 0 deletions
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<uint8_t*> (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;