From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3E3B64B5B8 for ; Tue, 9 Jul 2024 09:34:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D7A2568DC74; Tue, 9 Jul 2024 12:34:50 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2391968D97F for ; Tue, 9 Jul 2024 12:34:42 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1720517681; bh=oi5yUIcmTbp+4I8UfzjoSsflnr2AAGZ45eTdIaIsDHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iz5AveIAcQtty5GM2itgmOj9e5xscuW0ZCCtswUDAEF5FXhCazBMrUD1XNFa58gL5 zFerFz8qSO+Tk8sUxtWhuoNTXDcEcLGIzIeBkZf4+gSl2byeeVl6RPanq44ULokCJw fvSlE3ZUYLK/Wbu3vADVEkNAKVar3FWb5Fir2n3o= Received: from localhost (unknown [217.111.52.58]) by haasn.dev (Postfix) with ESMTPSA id CC92E4079C; Tue, 9 Jul 2024 11:34:41 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Tue, 9 Jul 2024 11:34:37 +0200 Message-ID: <20240709093437.16563-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240709093437.16563-1-ffmpeg@haasn.xyz> References: <20240709093437.16563-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avfilter/vf_scale: test return code of scale_frame() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas Instead of testing the returned frame against NULL, test the return code itself, going more in line with the usual behavior of such functions. --- libavfilter/vf_scale.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index a1a322ed9e..ae7356fd7b 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -883,7 +883,6 @@ static int scale_frame(AVFilterLink *link, AVFrame **frame_in, int frame_changed; *frame_in = NULL; - *frame_out = NULL; if (in->colorspace == AVCOL_SPC_YCGCO) av_log(link->dst, AV_LOG_WARNING, "Detected unsupported YCgCo colorspace.\n"); @@ -1064,14 +1063,15 @@ FF_ENABLE_DEPRECATION_WARNINGS } ret = scale_frame(ctx->inputs[0], &in, &out); - if (out) { - out->pts = av_rescale_q(fs->pts, fs->time_base, outlink->time_base); - return ff_filter_frame(outlink, out); - } + if (ret < 0) + goto err; + + av_assert0(out); + out->pts = av_rescale_q(fs->pts, fs->time_base, outlink->time_base); + return ff_filter_frame(outlink, out); err: - if (ret < 0) - av_frame_free(&in); + av_frame_free(&in); return ret; } -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".