From patchwork Thu Mar 31 20:12:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 35115 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c05:b0:7a:e998:b410 with SMTP id bw5csp294507pzb; Thu, 31 Mar 2022 13:13:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2iTIPa/hN8wnMT0od6QGof9nAxgQN9kGL/F72/GOfzRcDfXH+SkpKBnsrO7EZJZWtoOF0 X-Received: by 2002:a05:6402:1d4a:b0:419:7c50:dcbf with SMTP id dz10-20020a0564021d4a00b004197c50dcbfmr17829568edb.340.1648757602419; Thu, 31 Mar 2022 13:13:22 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qh25-20020a170906ecb900b006dfb07cee7fsi385492ejb.11.2022.03.31.13.13.21; Thu, 31 Mar 2022 13:13:22 -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=@outlook.com header.s=selector1 header.b=TVkZVyty; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 62CF568020D; Thu, 31 Mar 2022 23:13:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-oln040092072107.outbound.protection.outlook.com [40.92.72.107]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 093BE68020D for ; Thu, 31 Mar 2022 23:13:09 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mUJZWQ7QbdVwZCznuQxVQHnRYKCyMjz+XTTtRG6u4ghg1jnWmTdRk8ABzbA3LzploIgRTJifRPq5qSTir+tEGGhDsF94Dbd5AU9dxY0Mf+VU3v/jrnVotuUuHho41GnvjGK/H5rsMOkVPTnyvDolEqYxxM6A283GUxg4Kn+2qOuLMwse1nlSP77jLvbI6B6bOHTBdEqNQQxgiTFzVGNLSloB7pnxjV+UZJHb4BLjs0RgbjSeDZZUSTBfoimpOHIuZoN5IM6/LSuI8rljFsha7Nz7jNMaJUtJ4mcq4eTeE10oUb9UaYjxYo+U/9sWfLqTqdAxysy5yHBVxTRh3pB/WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PNswz1qUVSjTtBAud3eSUvlVh2BWdN/8aDudxrFmwUg=; b=jPhyJElw2Rff3ZwN7C2bhKmSank4+olUf2jLVKpsswZ7xwgnieciR+Iy6qNc/25KhDGDaVqJrHfSZB86AO29hIP2cCo3/oPv8qwoTq47TayATg/EAgWks1/A/euqHoB1riko21txTISErvfpoq9HBgzysQHsFTAW5UsRJQ5heOlyrAGyH8e+W49r32TuNwy/sV1FIqDZT7AiXFlri6weLsggzxU2iTLQZPzP3jgidvJyBLDgk0MsFNtyxJRtWqaUW8vJOoF0ZA/irs+0e0pmN5GoBlde+HtHi/lG8r+2krcBWO3+fDI1YIFlnsaxANE21LJtmgJQt7p39sDb8OfZVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PNswz1qUVSjTtBAud3eSUvlVh2BWdN/8aDudxrFmwUg=; b=TVkZVytyrvMyw9sPw9DC5GEfgGb7JaDy0gfcklkOftG1yeU/S+yeaV3sUnr7YPiVW2eC91H3AsOAZZ/QN0v97DIME8r2u8EX7Uga9Wag4AGBdakBu71yhdpG1irwTQSiVv5uYypz/PRKGjZolbwIAqhpkZxuwhR0YZjHUX6qyQF5jNyJZdzjGAMl5FzfimjCHT9ZMLcIsq7n3XouZedDqgsox75MJ8yFABPBrjcyXUtONSBCxNxrZFHbn/4oGV/dsr3d35Bwa7Qrqbdsb5/RIDLu/7sqQV+wD+NEXz3vIO4hoaXPx2Q+9P762BcLgDln9tb9RL+9p0AX0O8dSxASkQ== Received: from AS1PR01MB9564.eurprd01.prod.exchangelabs.com (2603:10a6:20b:4d1::16) by AM6PR01MB5158.eurprd01.prod.exchangelabs.com (2603:10a6:20b:95::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.21; Thu, 31 Mar 2022 20:13:08 +0000 Received: from AS1PR01MB9564.eurprd01.prod.exchangelabs.com ([fe80::9070:a5fd:e532:bdf8]) by AS1PR01MB9564.eurprd01.prod.exchangelabs.com ([fe80::9070:a5fd:e532:bdf8%3]) with mapi id 15.20.5102.022; Thu, 31 Mar 2022 20:13:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 31 Mar 2022 22:12:58 +0200 Message-ID: X-Mailer: git-send-email 2.32.0 X-TMN: [VK3VG2ds2ii6HWA9EDtEpg5p0OZI2iJK] X-ClientProxiedBy: FR2P281CA0022.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::9) To AS1PR01MB9564.eurprd01.prod.exchangelabs.com (2603:10a6:20b:4d1::16) X-Microsoft-Original-Message-ID: <20220331201259.665495-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c62793ff-4472-4e84-0356-08da1352dee0 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiTioWqjWavlllrypNQF6cxLWMcETpAIOuzsFjMUwfpJdHxyQNsMZi6Vqm3O4GgnZVWTN4O3LkGekA4WAVz2EGA9BM/Inystec4LIkgo8MTXGERZ/POJ4biJjt17QN5yxDo3GeAnxBzfTAnrm+vTUwLgidLk21s3PQP2k83WB8crlon5/b0d/JA4RjDyI+YnwTOYsFd+/abu/RzJCatCUg/XdSWFSdwX7+RI4qyrWTGmhgSNKaLvbyw4yglaMUwUfqI5+lp7Kn0fYTEo95XfHRtKkiPXkLYwD13mkJFQzYk9rnZN3OpmnYAYq8HEb3yQDzsIUXkRK+OlazUDHloor/GT02VkYdQ4jU7/K0SM71wsEkfHZ8Bf/tUgub+tavXQYwuIvuG0cPfJJyJAMsmemCdlOZkvMkh6oBjwldE91C0JByzxpY65uoaTrxfeWda3df2LriTANKKlBee/PKY2nn9Hicc5gvLrgqBSRf6iA/mNQNYb3SIZd5t06gSd+tomBcPwk6sKXCrwCEF3ZCCYOJagJXUpgXQiCjCU3O4cob/iZVTXghzeyOaSFWICT/Nd6dCuRpkEnKBr8NbglxGqFAaO0K7Je06psKDauSdpWcv/VjY+guWVUVySV7qe06cZaw5qD3YgcW2he2b3/u+eImyLcCbCL1PG4vDuJiOuto2bIrJiltkOWDuR4JS3DJ3OgKMWcgYGnM91e5Z2ces1zd8599VMzR9o1r/lzBGfK8B/Jye2vlZ5gB+5MxwDnjdQGac= X-MS-TrafficTypeDiagnostic: AM6PR01MB5158:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g37eo4EVZEGTNXZ4l3yOVDt3UKIPbpEsW0xDXxH+b7Zcl21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0356-08da1352dee0 X-MS-Exchange-CrossTenant-AuthSource: AS1PR01MB9564.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2022 20:13:08.1469 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR01MB5158 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/vp9_raw_reorder_bsf: Fix leak of cached packet 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: aeWU9i6E65HH In case the BSF has not been drained before flushing/closing, the context's next_frame might be set; yet it is not freed in flush or close. The former only zeroes it (which automatically causes a leak in case it was set). So do this when closing and flushing. Signed-off-by: Andreas Rheinhardt --- libavcodec/vp9_raw_reorder_bsf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/vp9_raw_reorder_bsf.c b/libavcodec/vp9_raw_reorder_bsf.c index e7d301cb85..368dcb26c2 100644 --- a/libavcodec/vp9_raw_reorder_bsf.c +++ b/libavcodec/vp9_raw_reorder_bsf.c @@ -396,7 +396,7 @@ static void vp9_raw_reorder_flush(AVBSFContext *bsf) for (int s = 0; s < FRAME_SLOTS; s++) vp9_raw_reorder_clear_slot(ctx, s); - ctx->next_frame = NULL; + vp9_raw_reorder_frame_free(&ctx->next_frame); ctx->sequence = 0; } @@ -407,6 +407,7 @@ static void vp9_raw_reorder_close(AVBSFContext *bsf) for (s = 0; s < FRAME_SLOTS; s++) vp9_raw_reorder_clear_slot(ctx, s); + vp9_raw_reorder_frame_free(&ctx->next_frame); } static const enum AVCodecID vp9_raw_reorder_codec_ids[] = {