From patchwork Sat Aug 8 14:02:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 21543 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 69C5F44927A for ; Sat, 8 Aug 2020 17:10:22 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 40D1B68B941; Sat, 8 Aug 2020 17:10:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8353E68B919 for ; Sat, 8 Aug 2020 17:10:15 +0300 (EEST) Received: by mail-ej1-f66.google.com with SMTP id kq25so4966884ejb.3 for ; Sat, 08 Aug 2020 07:10:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F7B43d+Th2EvqAVsmFIpaY9qpDuzm2LmyZ5pjvAcQ6U=; b=hbEmifu5sNeh77Y4ygsCDN3vwLLjbvlqJvzjuFI0doOlIHRw8FtlCdghRJYJ4EC53Y QHZRA42RS+f6KELgYHHX1Vd2qEKk56JoZkB1Ibp/ZaOi6OQzGh5OShZ5pggVIecb4u4e Bj1U6PPOi0oRiBtZlusOTSDC/WcuyH24ms7NTkKBMYEbnLqfHBxaQUHw5xZh8xsg4b3L MsjNCT4rq9qeFhkSAVCwBYyG/w43ARv89unFOGnT+ADanSSGrhB1DoFcb18aOgseu1Wb lWiL8T0H7KdRlQiMPqouEpfnfQqTwgO2jfdMPI+r3EBpewFZvJxJvNjEsiYryj0sWhof U34Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F7B43d+Th2EvqAVsmFIpaY9qpDuzm2LmyZ5pjvAcQ6U=; b=olcIJGduSdO1OCZUttNjxEJStKd+rjnVxRjF8u8oDuZg9lKqk9FO+4QzPkpd3ZzgAB kxQaHrQBBsxPV9SOuJBhFYZ1JqLiVleaOei26XnJhSrFfBbU89tm2mW0MRCXFZ+Espn9 fvTTaugd4lZvwWU/QQ4Praly/hL15sUr8jt0NB8S6O83J6Mf0m9sDCqvGS/TnLzX/APZ lbfMRmmqGugj3GAxODaRTJVAiFR1qF+FIskWS+4LXi6QwCdASwZPERLAADLj5PZClWL0 d35A7BcohVKGYi3KO/0ZT9VSgeaW1hVDGUGK93+P5EIwdngLcruLioSSGm9AdYwPxQVW nz2g== X-Gm-Message-State: AOAM530MZpAB1mIomHrlaO1V9+nw9zHEKBz6WvS8UE3sII32+D6pgM+h S5bWuhzpXdEQRU+1LnuOBElgxp6K X-Google-Smtp-Source: ABdhPJzTdBmOuc6Albbof5NcQcv2vLjD6DV2w+pt2n9WD8TJjBw5G02418kWw1gYGVUVJH2fbGC/ZA== X-Received: by 2002:a17:906:7787:: with SMTP id s7mr14831392ejm.533.1596895814689; Sat, 08 Aug 2020 07:10:14 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc10296.dynamic.kabel-deutschland.de. [188.193.2.150]) by smtp.gmail.com with ESMTPSA id g21sm7618991edm.65.2020.08.08.07.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Aug 2020 07:10:14 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 8 Aug 2020 16:02:02 +0200 Message-Id: <20200808140202.586-5-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200808140202.586-1-andreas.rheinhardt@gmail.com> References: <20200808140202.586-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] avfilter/formats: Simplify cleanup for ff_merge_* functions 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Now that the output's refs-array is only allocated once, it is NULL in any error case and therefore needn't be freed at all. Furthermore, it is unnecessary to av_freep(&ptr) when ptr == NULL. Signed-off-by: Andreas Rheinhardt --- libavfilter/formats.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index ae44006dfe..e452fd0408 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -141,10 +141,9 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b, return ret; fail: if (ret) { - av_freep(&ret->refs); av_freep(&ret->formats); + av_freep(&ret); } - av_freep(&ret); return NULL; } @@ -168,10 +167,9 @@ AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a, return ret; fail: if (ret) { - av_freep(&ret->refs); av_freep(&ret->formats); + av_freep(&ret); } - av_freep(&ret); return NULL; } @@ -261,10 +259,9 @@ AVFilterChannelLayouts *ff_merge_channel_layouts(AVFilterChannelLayouts *a, fail: if (ret) { - av_freep(&ret->refs); av_freep(&ret->channel_layouts); + av_freep(&ret); } - av_freep(&ret); return NULL; }