From patchwork Thu Nov 23 19:14:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 44766 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bca6:b0:181:818d:5e7f with SMTP id fx38csp801716pzb; Thu, 23 Nov 2023 11:19:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGddvwHaiSZaDFyOU9rSsXczUR6VSUbCmy/LooUBRLDmvjvKi55RrzrHj9kyrCgZRvtqm2k X-Received: by 2002:a05:6512:3f0f:b0:50a:a14e:92c5 with SMTP id y15-20020a0565123f0f00b0050aa14e92c5mr161725lfa.45.1700767139877; Thu, 23 Nov 2023 11:18:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700767139; cv=none; d=google.com; s=arc-20160816; b=LzH1O51Wwky4rwFb7wmpFH4Ngt0waQHGImLM6557527LZD8iKmiJNgWmNtQt9gv71J 2VVu9qmNs+FAZnG53P7CL/WgJozhXQ+X6VMAOnkVSVvx3nXE3Mm1Bia6gZWVSRDnKP6u imjL6WkILCMIffr4zrLLNDZnj+RRn6zQrlCDQn9o9m4OU26+dQThiiOsgK//9y0saPia MlfDTe0+aO2xBaoOKR6onelHINLfYtUcqZGZyoKX9bMoD/uM6PD7FjzO48kYEafSn6sp XH42GJ2E47qx/cnDBYzXNoUnGB3qCB/Ffy26vQKOTOPm15DNAtsJMiyZ+z/WvcYkPstG YvZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=emhmNUNvjsMmNY2Uv5GwxcZOdEfpTaCUJjq2vHmLZsE=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=RLkJ9WQfLr7pnC7D+v3Cwosl+a4BCx+dC8DARL+eb9cIpNQLzntpYt0VwtwFm7Z4SG QtdqR4RhttJYv6NPRLMY9/NfV3SHttuxC93JvDV5e5i6oa8UdfTCfOhug+Uf2U2VMX7e 3ptFVcASxv86vzznexNPrAgjg+MklVKTYcStxr+NqiWmm2K8FHuC91oThapBr7a3Rb6X zOHS5sfT7Fv1lOqN15AfJqwFyr1VKWJBO01Ia8WPFSkaVPduVv7UP2wG8p6+/8DOcVZX VlLxM6EPPLQa3oa0Pqs8SpRFZPLfGmwiIX1K10UDykNGdTmEXSXB/tg/kuDmhD5Y3Wvp mc/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t10-20020a1709060c4a00b009ffc3828555si937728ejf.958.2023.11.23.11.18.59; Thu, 23 Nov 2023 11:18:59 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D1EA368CEDA; Thu, 23 Nov 2023 21:18:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ECEE168CC18 for ; Thu, 23 Nov 2023 21:18:16 +0200 (EET) Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 96D5414CE for ; Thu, 23 Nov 2023 20:18:16 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id f_ommJPEeEN1 for ; Thu, 23 Nov 2023 20:18:16 +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 1B7D81486 for ; Thu, 23 Nov 2023 20:18:15 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 00FE63A0585 for ; Thu, 23 Nov 2023 20:18:15 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 23 Nov 2023 20:14:56 +0100 Message-ID: <20231123191524.11296-3-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231123191524.11296-2-anton@khirnov.net> References: <20231123191524.11296-2-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/13] lavfi/buffersink: avoid leaking peeked_frame on uninit 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rV7yEc0dU7Hz --- libavfilter/buffersink.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index ca2af1bc07..3da3331159 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -164,6 +164,13 @@ static av_cold int common_init(AVFilterContext *ctx) return 0; } +static void uninit(AVFilterContext *ctx) +{ + BufferSinkContext *buf = ctx->priv; + + av_frame_free(&buf->peeked_frame); +} + static int activate(AVFilterContext *ctx) { BufferSinkContext *buf = ctx->priv; @@ -385,6 +392,7 @@ const AVFilter ff_vsink_buffer = { .priv_size = sizeof(BufferSinkContext), .priv_class = &buffersink_class, .init = common_init, + .uninit = uninit, .activate = activate, FILTER_INPUTS(ff_video_default_filterpad), .outputs = NULL, @@ -397,6 +405,7 @@ const AVFilter ff_asink_abuffer = { .priv_class = &abuffersink_class, .priv_size = sizeof(BufferSinkContext), .init = common_init, + .uninit = uninit, .activate = activate, FILTER_INPUTS(ff_audio_default_filterpad), .outputs = NULL,