From patchwork Sun Aug 9 15:57:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 21563 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 3810044B9EE for ; Sun, 9 Aug 2020 18:58:43 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 17FD368B00B; Sun, 9 Aug 2020 18:58:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 654C968AD50 for ; Sun, 9 Aug 2020 18:58:33 +0300 (EEST) Received: by mail-ej1-f51.google.com with SMTP id o23so7008504ejr.1 for ; Sun, 09 Aug 2020 08:58:33 -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=Gmxo+cjXERpOug11FUZBprj8GcUAOzebnaRy4eaJ8NI=; b=jNbnwh9CMiYnUAUMBGEGQh08DiTQFmza53mP4+HykhT8Jk/Elyz7Kug2dsgKYznTkf NNwDmf0I1OV6I3m+vdk9SOS6uYjLVeXKi6ohIvq4PeZi/ObOEHKvIk+n4h9fG2hLLxaQ 6tCvKlllOIbj/dUfxDWGmf+FxT3xqXwwtzb0Nsor4k7oDNoNLn0j3geUrQsiDcnkCfxN TMx0mtrYgMzmlwBDOBmLaXjbVYps+1zQJlOzaHu1p4VoV56EHXsaBu9nabkWr0hUNDDZ whsRBg3E1+5IF/Ox97SzJdE6u9rt0wG37Dn+TwDaLjuRvDlaGa3bYrsAcYvairzjDaq2 uxMw== 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=Gmxo+cjXERpOug11FUZBprj8GcUAOzebnaRy4eaJ8NI=; b=kcfYonhrXQYdJjDKINgH6pc/5jh4WgPgC7v77H+aNMKij2Uoeiy1syX9Y/w3s6BPzm Krj6shequQCP+yDXkagpTkjGFskA4QbhFrEAELIoPxIo9YiugL19ukxu62Nvr4hkjcOs ohDaUcKRGqur5O6WfL89ZrvBFAezy/ajOWQR/x8UYcdnu1CqC3LaKNPLTBoES0Ll/T8U DWs7ekvm+/YEyd4NRdNDXFHdkIA3CvQVevna1lD5aQ4Ii4in2Kn8QPtqUVouq6vZ8qWb e5sgZiI8HBqKpYH5VNJ/ty9YPEhFSHC5q2Yv9DJDcHVl3by2sduEXv/rsj4Oo1zjY4Vs sx/g== X-Gm-Message-State: AOAM533HDWuahTeMpcFoHTAOAXDwCk4SaDgZW2yDfx2xW1xI9yUz4KUu 5LQadtWTD/kkERhAd8CIb9v+eAdJ X-Google-Smtp-Source: ABdhPJwHkrFUq4HueNB84ldlyFSlt6swqwjwHZf8ujy6hYza6VTnVpKNuSmE1Qde4sYwkATngaeqLw== X-Received: by 2002:a17:906:c2c8:: with SMTP id ch8mr17567744ejb.161.1596988712827; Sun, 09 Aug 2020 08:58:32 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc10296.dynamic.kabel-deutschland.de. [188.193.2.150]) by smtp.gmail.com with ESMTPSA id g11sm5360290edv.95.2020.08.09.08.58.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Aug 2020 08:58:32 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 9 Aug 2020 17:57:46 +0200 Message-Id: <20200809155748.30092-13-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 19/21] avfilter: Remove redundant ff_formats/channel_layouts_unref() 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" ff_add_format() and ff_add_channel_layout() already unref the list upon error. Signed-off-by: Andreas Rheinhardt --- These ff_formats/channel_layouts_unref() also didn't do anything before this patchset, as none of these lists has any owner. libavfilter/af_aformat.c | 9 ++++----- libavfilter/vf_shuffleplanes.c | 1 - libavfilter/vf_weave.c | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c index 1a702778c3..0ea470014c 100644 --- a/libavfilter/af_aformat.c +++ b/libavfilter/af_aformat.c @@ -60,7 +60,7 @@ static const AVOption aformat_options[] = { AVFILTER_DEFINE_CLASS(aformat); -#define PARSE_FORMATS(str, type, list, add_to_list, unref_fn, get_fmt, none, desc) \ +#define PARSE_FORMATS(str, type, list, add_to_list, get_fmt, none, desc) \ do { \ char *next, *cur = str, sep; \ int ret; \ @@ -83,7 +83,6 @@ do { \ return AVERROR(EINVAL); \ } \ if ((ret = add_to_list(&list, fmt)) < 0) { \ - unref_fn(&list); \ return ret; \ } \ \ @@ -102,11 +101,11 @@ static av_cold int init(AVFilterContext *ctx) AFormatContext *s = ctx->priv; PARSE_FORMATS(s->formats_str, enum AVSampleFormat, s->formats, - ff_add_format, ff_formats_unref, av_get_sample_fmt, AV_SAMPLE_FMT_NONE, "sample format"); - PARSE_FORMATS(s->sample_rates_str, int, s->sample_rates, ff_add_format, ff_formats_unref, + ff_add_format, av_get_sample_fmt, AV_SAMPLE_FMT_NONE, "sample format"); + PARSE_FORMATS(s->sample_rates_str, int, s->sample_rates, ff_add_format, get_sample_rate, 0, "sample rate"); PARSE_FORMATS(s->channel_layouts_str, uint64_t, s->channel_layouts, - ff_add_channel_layout, ff_channel_layouts_unref, av_get_channel_layout, 0, + ff_add_channel_layout, av_get_channel_layout, 0, "channel layout"); return 0; diff --git a/libavfilter/vf_shuffleplanes.c b/libavfilter/vf_shuffleplanes.c index 6c718893ce..c5a376d50b 100644 --- a/libavfilter/vf_shuffleplanes.c +++ b/libavfilter/vf_shuffleplanes.c @@ -64,7 +64,6 @@ static int query_formats(AVFilterContext *ctx) if (i != 4) continue; if ((ret = ff_add_format(&formats, fmt)) < 0) { - ff_formats_unref(&formats); return ret; } } diff --git a/libavfilter/vf_weave.c b/libavfilter/vf_weave.c index 8951b09095..8d4eb3d5a4 100644 --- a/libavfilter/vf_weave.c +++ b/libavfilter/vf_weave.c @@ -60,7 +60,6 @@ static int query_formats(AVFilterContext *ctx) if (!(desc->flags & AV_PIX_FMT_FLAG_PAL) && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) { if ((ret = ff_add_format(&formats, fmt)) < 0) { - ff_formats_unref(&formats); return ret; } }