From patchwork Thu Mar 30 21:34:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 3205 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.44.195 with SMTP id s186csp1750732vss; Thu, 30 Mar 2017 14:35:01 -0700 (PDT) X-Received: by 10.28.134.70 with SMTP id i67mr236969wmd.124.1490909701087; Thu, 30 Mar 2017 14:35:01 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x8si460419wmd.88.2017.03.30.14.35.00; Thu, 30 Mar 2017 14:35:01 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B01B06891EC; Fri, 31 Mar 2017 00:34:57 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-3.mx.upcmail.net (vie01a-dmta-pe03-3.mx.upcmail.net [62.179.121.162]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1B5C68838C for ; Fri, 31 Mar 2017 00:34:50 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1cthiU-0006Vo-En for ffmpeg-devel@ffmpeg.org; Thu, 30 Mar 2017 23:34:50 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 2Map1v00V0S5wYM01Maq9Q; Thu, 30 Mar 2017 23:34:50 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 30 Mar 2017 23:34:48 +0200 Message-Id: <20170330213448.3806-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.11.0 Subject: [FFmpeg-devel] [PATCH] avfilter/vf_zoompan: Free out frame on error X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes: CID1398578 Signed-off-by: Michael Niedermayer --- libavfilter/vf_zoompan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c index 136d6c83fd..53a0700e37 100644 --- a/libavfilter/vf_zoompan.c +++ b/libavfilter/vf_zoompan.c @@ -191,7 +191,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va s->sws = sws_alloc_context(); if (!s->sws) { ret = AVERROR(ENOMEM); - return ret; + goto error; } for (k = 0; in->data[k]; k++) @@ -206,7 +206,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va av_opt_set_int(s->sws, "sws_flags", SWS_BICUBIC, 0); if ((ret = sws_init_context(s->sws, NULL, NULL)) < 0) - return ret; + goto error; sws_scale(s->sws, (const uint8_t *const *)&input, in->linesize, 0, h, out->data, out->linesize); @@ -218,6 +218,9 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va s->sws = NULL; s->current_frame++; return ret; +error: + av_frame_free(&out); + return ret; } static int filter_frame(AVFilterLink *inlink, AVFrame *in)