[FFmpeg-devel,3/3] avfilter/af_asetnsamples: do not leak frame on ENOMEM

Submitted by Marton Balint on Oct. 7, 2018, 9:02 p.m.

Details

Message ID 20181007210228.16822-3-cus@passwd.hu
State New
Headers show

Commit Message

Marton Balint Oct. 7, 2018, 9:02 p.m.
Fixes Coverity CID 1416352.

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

Comments

Paul B Mahol Oct. 8, 2018, 8:42 a.m.
On 10/7/18, Marton Balint <cus@passwd.hu> wrote:
> Fixes Coverity CID 1416352.
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavfilter/af_asetnsamples.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>

OK

Patch hide | download patch | download mbox

diff --git a/libavfilter/af_asetnsamples.c b/libavfilter/af_asetnsamples.c
index 30fabede26..e8daec8d8f 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);