From d6a1f711bcd1035bea95157ae6559988000e453d Mon Sep 17 00:00:00 2001
From: Marton Balint <cus@passwd.hu>
Date: Sun, 7 Oct 2018 22:47:19 +0200
Subject: [PATCH] avfilter/af_asetnsamples: do not leak frame on ENOMEM

Fixes Coverity CID 1416352.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/af_asetnsamples.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_asetnsamples.c b/libavfilter/af_asetnsamples.c
index 30fabede264..e8daec8d8f9 100644
--- a/libavfilter/af_asetnsamples.c
+++ b/libavfilter/af_asetnsamples.c
@@ -71,8 +71,10 @@ static int activate(AVFilterContext *ctx)
             return ff_filter_frame(outlink, frame);
 
         pad_frame = ff_get_audio_buffer(outlink, s->nb_out_samples);
-        if (!pad_frame)
+        if (!pad_frame) {
+            av_frame_free(&frame);
             return AVERROR(ENOMEM);
+        }
 
         av_samples_copy(pad_frame->extended_data, frame->extended_data,
                         0, 0, frame->nb_samples, frame->channels, frame->format);
-- 
GitLab