From patchwork Mon Oct 7 10:50:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 52097 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:938f:0:b0:48e:c0f8:d0de with SMTP id z15csp2043558vqg; Mon, 7 Oct 2024 09:17:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVdZ8CIy53gh0pwrzchXoI5CA/EsCdjcT++2009z4ff19J26OrOgmyU/Kp05spECwmPaxbc80jjcb56vgrGLNxk@gmail.com X-Google-Smtp-Source: AGHT+IGQmd6NVPhbmFtoFgUcjtUvVBUCYp4sgVdISEn656K71BmOp3A+k+HxkjLhuUdaPYs9I/c8 X-Received: by 2002:a05:6512:1389:b0:539:958f:1b8b with SMTP id 2adb3069b0e04-539ab9eb03fmr5406164e87.50.1728317765822; Mon, 07 Oct 2024 09:16:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728317765; cv=none; d=google.com; s=arc-20240605; b=iKZhp5FD6fhq3JGp55aEW8k95aoK30FpiU1sm+sQUisout3felzMeLvMYivii3cHvC 2CawM/hR5J3UZCjdtX4gG179PVeC7HPvRsSw/wB8Tb84ql7r8bryqhMlOBSTO70d7Up4 cRNigIGIt1Khobtiznv7TFos7RgkqtHOKIhIW7n+SbZJGG0JG4mT8wpqF20w1vb0/K65 OiawYGTC2cKKdWrmr8xuq2yfAb1B8HmAf6UGNp4G/9Y+a1uKhsPHwDjIyr7DnYs6VlXJ gVYMvFE55bjsGJziWE5voy7d8Lbq5R76ONY6xWYpMDwTvQg44JMPEzArhCZ6WZA4XziC XxRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:dkim-signature:delivered-to; bh=yaFYHGO6TdLuxlhgKCDCVBmiqdlCAd5ux0oyuFgvixI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=jOEFc9VdFLODenm0WVtJK/QB9+cJgV36g6xoCWH/vrWLpdL7VfS3+L+p1vNlag795s W5s3zLFAp9hPO/8IVg8wcVKIJjWlL/YQDMhnkPvO9aaj3GYhZCrYtf1FM+0Cnth69FLo oRcqC+mI9DK3oKgaf8tAgNp9z8kUMv2Iu7YLnliy3UacRSkOXISqIzlwLyAOzaI9MVoU Bp4UXMSpRvPnQXfYr3+hnUSx2pvKvvX2nU6Vr5rutD3YtSIRT0nsP/hxdvinwjbgeulh QWb/Vfh3R1JAzqI9CQ6OsZtWLI82YQrno8JOxqieJsQR0ZWLRHFlLL9vr/DKFzQ4y+n+ KKTg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=n8h2+Oh1; 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 2adb3069b0e04-539aff25736si1990702e87.355.2024.10.07.09.16.05; Mon, 07 Oct 2024 09:16:05 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=n8h2+Oh1; 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 0145768DAE5; Mon, 7 Oct 2024 13:50:48 +0300 (EEST) 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 D3DC768D9E9 for ; Mon, 7 Oct 2024 13:50:38 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=n8h2+Oh1; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 4B4324DF6 for ; Mon, 7 Oct 2024 12:50:38 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id c84WYn2ItACN for ; Mon, 7 Oct 2024 12:50:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1728298236; bh=vOgys0xq7qQA/gR6TaF9AwWx5Fn2/gQJHmrpxQO6eqQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=n8h2+Oh1E7ti/RLv0pz2VeR/VYX0aqMt4VvIU0Wo3+B29iTSt8eMb4UX3G5xixj91 hc+5oXKtyxNMFVE+Ta3ZopLMy01GE0mmwY4m18IY4APzf9MVByNYxtTPgFNB+QCX30 MxOHYKCAI6m2rM15qm6FUOfl6AluVgR19bsVMBQ89UfepBqYnq8y2fNWXnmPLNZTi/ INx137WAb0SjHkkPDw585hf8+afIj9gZ2mhWzxHTcZUKZ4+Py7QJjXXt9GiDmwGjJK eYbA/ZHaTdJvpYf6sW7UkTxBRZoWTBM5Qt5rpI5aW5PBLNU7Y+X4+dZ5Dl7qkK4f8x nvJfWdgwwOIGQ== 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 CBB0E4E04 for ; Mon, 7 Oct 2024 12:50:36 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 817923A1A1B for ; Mon, 07 Oct 2024 12:50:30 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Oct 2024 12:50:15 +0200 Message-ID: <20241007105016.1597-4-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007105016.1597-1-anton@khirnov.net> References: <20241007105016.1597-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg_filter: do not leak graph_desc on fg_create() failure 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: 21YPojaQP+ji fg_create() is passed a malloced string and assumed to always tak ownership of it. --- fftools/ffmpeg_filter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index faab003e71..4d444c161f 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1058,8 +1058,10 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch) int ret = 0; fgp = av_mallocz(sizeof(*fgp)); - if (!fgp) + if (!fgp) { + av_freep(&graph_desc); return AVERROR(ENOMEM); + } fg = &fgp->fg; if (pfg) { @@ -1068,6 +1070,7 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch) } else { ret = av_dynarray_add_nofree(&filtergraphs, &nb_filtergraphs, fgp); if (ret < 0) { + av_freep(&graph_desc); av_freep(&fgp); return ret; }