From bd115a40081ec6527e1e13231caec23f36768d73 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 4 Nov 2018 22:01:33 +0100 Subject: [PATCH] decoder/ffmpeg: use AtScopeExit() to call av_packet_unref() --- src/decoder/plugins/FfmpegDecoderPlugin.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index 92ab33afa..0abd04841 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -627,6 +627,10 @@ FfmpegDecode(DecoderClient &client, InputStream &input, /* end of file */ break; + AtScopeExit(&packet) { + av_packet_unref(&packet); + }; + FfmpegCheckTag(client, input, format_context, audio_stream); if (packet.size > 0 && packet.stream_index == audio_stream) { @@ -640,8 +644,6 @@ FfmpegDecode(DecoderClient &client, InputStream &input, min_frame = 0; } else cmd = client.GetCommand(); - - av_packet_unref(&packet); } }