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 32EF148234 for ; Thu, 14 Dec 2023 19:33:51 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 42F4368D2B4; Thu, 14 Dec 2023 21:32:55 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5E0A468D29C for ; Thu, 14 Dec 2023 21:32:45 +0200 (EET) Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id F24D51CAF for ; Thu, 14 Dec 2023 20:32:44 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id Jf6PBk6WcJvT for ; Thu, 14 Dec 2023 20:32:44 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 945C41C9B for ; Thu, 14 Dec 2023 20:32:38 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 99C993A0706 for ; Thu, 14 Dec 2023 20:32:31 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 14 Dec 2023 20:31:37 +0100 Message-ID: <20231214193138.2503-8-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231214193138.2503-1-anton@khirnov.net> References: <20231214193138.2503-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 8/9] fftools/ffmpeg_mux: deduplicate uniniting EncStats 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 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: --- fftools/ffmpeg_mux.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 88ce3cd60c..357f34172f 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -773,6 +773,13 @@ int of_write_trailer(OutputFile *of) return mux_result; } +static void enc_stats_uninit(EncStats *es) +{ + for (int i = 0; i < es->nb_components; i++) + av_freep(&es->components[i].str); + av_freep(&es->components); +} + static void ost_free(OutputStream **post) { OutputStream *ost = *post; @@ -818,17 +825,9 @@ static void ost_free(OutputStream **post) av_freep(&ost->enc_ctx->stats_in); avcodec_free_context(&ost->enc_ctx); - for (int i = 0; i < ost->enc_stats_pre.nb_components; i++) - av_freep(&ost->enc_stats_pre.components[i].str); - av_freep(&ost->enc_stats_pre.components); - - for (int i = 0; i < ost->enc_stats_post.nb_components; i++) - av_freep(&ost->enc_stats_post.components[i].str); - av_freep(&ost->enc_stats_post.components); - - for (int i = 0; i < ms->stats.nb_components; i++) - av_freep(&ms->stats.components[i].str); - av_freep(&ms->stats.components); + enc_stats_uninit(&ost->enc_stats_pre); + enc_stats_uninit(&ost->enc_stats_post); + enc_stats_uninit(&ms->stats); av_freep(post); } -- 2.42.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".