From: Carl Hetherington Date: Mon, 10 Dec 2018 01:16:16 +0000 (+0000) Subject: Add a couple of missing deallocation calls and fix a warning X-Git-Tag: v2.13.83~5 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=dceecebd37d5e1b5c098ad1358310d3f276c703c;hp=6e16dcc7f8e13a9b96bd251f113588914db1b296;p=dcpomatic.git Add a couple of missing deallocation calls and fix a warning with current FFmpeg (returning AVERROR_EOF rather than 0 when a AVIO source is finished). --- diff --git a/src/lib/ffmpeg_image_proxy.cc b/src/lib/ffmpeg_image_proxy.cc index e38b80be1..46c9836e0 100644 --- a/src/lib/ffmpeg_image_proxy.cc +++ b/src/lib/ffmpeg_image_proxy.cc @@ -84,6 +84,9 @@ int FFmpegImageProxy::avio_read (uint8_t* buffer, int const amount) { int const to_do = min(int64_t(amount), _data.size() - _pos); + if (to_do == 0) { + return AVERROR_EOF; + } memcpy (buffer, _data.data().get() + _pos, to_do); _pos += to_do; return to_do; @@ -167,7 +170,9 @@ FFmpegImageProxy::image (optional) const _image.reset (new Image (frame)); + av_packet_unref (&packet); av_frame_free (&frame); + avcodec_close (codec_context); avformat_close_input (&format_context); av_free (avio_context->buffer); av_free (avio_context);