From patchwork Tue Aug 25 14:09:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 21923 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 A013F44B5DF for ; Tue, 25 Aug 2020 17:18:19 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 834AB68ABB4; Tue, 25 Aug 2020 17:18:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D98956807F1 for ; Tue, 25 Aug 2020 17:18:13 +0300 (EEST) Received: by mail-ed1-f66.google.com with SMTP id q4so1579856eds.3 for ; Tue, 25 Aug 2020 07:18:13 -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=W8rJ32eSy6jX7g2g30cV9K0The53rnN6rOZA5MrNCHI=; b=jXQegihwbF4lje0KnDKLTtfVgswuOmcvQZG1/3PC5hsX/hG92oRXvQa8LPsLFV2VZd UKUGIZuo2c+UvTx4YRT8iD0yWwEhG3wmOjt17S+sznBgG5Hiwz1OeIpFzYAGeQzq24T8 V9hCUSvVQUbUEYFPeW4UWytUd+chYd/5yq7i37QtVlm9MHiqiO8ptZmG6FEcA5szSTj/ RLkmDqqzTy4QZUCldWxI8c6PkmYmagXv8rfUesZodXAxUW6S7iTEW29toJJplu2ToAWo 7C8MM5UqrMLx7EierKiioUIRWI6viO8VAYw3EzsQYa5x7mBfUP1MYl5zOOjAOsG4KVFz HmIQ== 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=W8rJ32eSy6jX7g2g30cV9K0The53rnN6rOZA5MrNCHI=; b=bOlhmkLo3LUtL94fjtaZt+80Oj/nSR0uOWogzudyrAxSxGG6e3CvpTh5qtl69lzgSD MJEpdqc0Q7ZQRi6pQlUs/mJM+0sHvVi96VBkQ+zAHxYBFyqted3bsrWhPUlHaZ0y6gBS oez1ae8OIcA71K5D7OtXkv5i4PTqfQyIqjrJ3RPc5vq6PajrKsdf3nWV0oCv/rZCKsJm R/fBMe1XyxV14vBE/7A+eaJtLB+EQyqxSgIlUDBk5xb9hHgFrMiqDdyxiIMXnZEPM8wX iTVMy8HH/NwN61V/I1SGTJwHlKJGjV5NlHG4BTKHspTlxtKbxLVgLomvCNXtSDFOC/ZM WhDA== X-Gm-Message-State: AOAM531Z3FM6VM9TJF6qLsk5B9JXqiKs7QtfX1JYjPVN01DDwaC7RK4T LqiRgaZ+ZVBsAmmBtejg4vO+cCJBf74= X-Google-Smtp-Source: ABdhPJwQEva1nE4/IXsDFaMhU6cUG2Ovutbc/fp/ZupayYdItX6uYHqHgq5/c18FJMGDu4P0vJTg5w== X-Received: by 2002:a05:6402:3199:: with SMTP id di25mr10623219edb.315.1598364621305; Tue, 25 Aug 2020 07:10:21 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id k25sm10169806edx.96.2020.08.25.07.10.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 07:10:20 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 25 Aug 2020 16:09:23 +0200 Message-Id: <20200825140927.16433-15-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200825140927.16433-1-andreas.rheinhardt@gmail.com> References: <20200825140927.16433-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 15/19] avfilter/vf_signature: Fix leak of inpads' names 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" Signed-off-by: Andreas Rheinhardt --- It is not intended for these added lines to live very long: One can add flags to AVFilter.flags_internal that indicate that this filter wants the inpads/outpads' names be freed generically. This will allow to remove most of the code for freeing in/outpads. These flags can also be used to make ff_insert_in/outpad free the name itself upon error. Furthermore, one can make ff_insert_pad() return AVERROR(ENOMEM) if the name of the pad that is about to be inserted is NULL; this allows to remove the checks for allocation failure from the callers. libavfilter/vf_signature.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index 5ea55d5247..d09003746c 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -730,6 +730,8 @@ static av_cold void uninit(AVFilterContext *ctx) } av_freep(&sic->streamcontexts); } + for (unsigned i = 0; i < ctx->nb_inputs; i++) + av_freep(&ctx->input_pads[i].name); } static int config_output(AVFilterLink *outlink)