From patchwork Tue Jun 15 23:31:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28322 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4310533iol; Tue, 15 Jun 2021 16:33:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJF6GmUM1dQcvZe609JBdOjEsLGlWvvbt9pXRWP1tKdtgMfgadu7rSGukGOE/B5cBMEa4B X-Received: by 2002:a17:906:1701:: with SMTP id c1mr2008275eje.425.1623800038887; Tue, 15 Jun 2021 16:33:58 -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 ck12si272479edb.107.2021.06.15.16.33.58; Tue, 15 Jun 2021 16:33:58 -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=pPb5BTPA; 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 DA24A68991B; Wed, 16 Jun 2021 02:33:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2088.outbound.protection.outlook.com [40.92.89.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CC8D6688374 for ; Wed, 16 Jun 2021 02:33:17 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rb+Qui/SGk4TQ2FQIHFRsmj1icbaVB3h97JoPPJZvljr3aHiq1tVaOT9fI1TDJGKYvvNZx/WBwvmsDePoBEbgtVg6Ft7m/EC/F2SdA6fwON9ziAe4BWpIsVibOPpLowwmfVCIh73KKixvFdXGORVfpZhrYd88YceBeIl080R/4nJeqoSnSat8Y1IF6Mpg2uDlx07Mci4sBku+AQy7qHFbbWBg0yLwvwEFtr5I8GN9L1a+Me3j0Jf1/C1z+cwQAF9QVqO9Js+sAlqR/Frhe1pcLeMhYy8Dn5Y7NHIl4RaLacbTJk7sIsLDv8hWS5QU/7zfWu7XpV2YnXMy9iH/GSwjA== 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-SenderADCheck; bh=IDpWTt482CVVNi5GvZjnFag/sWu8V+C1p2GsM7BGVG4=; b=ijQ1ckL2PXc2glGrUYGAWN/PfWTSb8pBQHTlpjUDHPLNok0vrKaCITAFZjaIzOCJMSCdMQbv5Tgw0AqKkozoee3pYlSdh9X++mkO7aqcGwpB7fXdHRjfKLapfKhRt88H/keuBnVFt/8W/qvB9caG1nDjmbFES4gj/osWnDOIZ6qC9So9KMl7nmW4S9S/4R22zSncnv+R3hCd6zhEoBtQ3yCAyX4rkLZmhu06qWu9xvLLRjId5TYkmnzah3ID5HxZfv+nu2rROSxtDTu2Gzg6BrYFib+7XyJhkRxNekxIkbA0ZtCalqRC9118uhNi9EIC6dnqkK2kdDbIiDxx27VMxA== 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=IDpWTt482CVVNi5GvZjnFag/sWu8V+C1p2GsM7BGVG4=; b=pPb5BTPAzpXuZowv/JW+uMn3K8c9nTIonYGuCO+gSod5xreUYvqwofDXLhzcfXzR4SMmgJV1iNXRfCVUgdjbl7YxmSwaz5bTGItcj0BrtzL5tETnjMYjfWj2EjXcjQSrDqUDHLMAMPxSrW+pg9gBcCN0PFJ020IhboTtS5XeeL9kXu8JGINkMoh7mhlNFXQoaSeZCXf1tQTgPdyhjtLYmXZcudj+aps7/8LMHeo7iFbMeDldK+2ApR3imWaZT3e+k5C7OTzuIDXeTbgGe8BdMqcEhSl9KbUxCnIffRA+d2oCsw9kQMbgx/0em+9MaR5Va96fyLGKtM0Hsg8fCmhHbw== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::50) by DB8EUR05HT231.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21; Tue, 15 Jun 2021 23:33:16 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:fc0f::46) by DB8EUR05FT045.mail.protection.outlook.com (2a01:111:e400:fc0f::383) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.16 via Frontend Transport; Tue, 15 Jun 2021 23:33:16 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:97DD70BCB44E7E3E623ACDD70D356DAA5112F29E463E658773AC9E04AD3A87FC; UpperCasedChecksum:A83100DF144443333BA03F75C4EDA10E88125D8BB55CFCF2DE66186C10B37476; SizeAsReceived:7592; Count:48 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb%6]) with mapi id 15.20.4219.025; Tue, 15 Jun 2021 23:33:16 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:31:59 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [BEEhN9p2E5FyCjKNB9VQiAgXdj7wgqSP] X-ClientProxiedBy: PR3P189CA0063.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:b4::8) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210615233243.1173928-9-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.97.82) by PR3P189CA0063.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:b4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20 via Frontend Transport; Tue, 15 Jun 2021 23:33:15 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 82b827e6-d2eb-4231-ac21-08d93055f318 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk92w3tzm64AvYL7zulSvsPfnQlko6R4zZL9uDQjWl3sLB1yXlw6v2OtV5InpiTjezWAnHJusszu72GyP03p45lDm+biMMYqqTGmO7UewNbhAYRDHMbTMYDK97ptX427/LSxIUqa07s8nMvloelr042EadxhGwFWw3umqj4EOx0iGvhY6UFXfeW1nzqz88yLS9rgp87zS9cw/Egr7Yc3Nroq+gO+CNVawcLEWSondvxrOAkoYlbEqHuphyCFLjzzcUVuvmJfCSMo4xLdMdCMoo07cfxldYESA/uibEQMv5+aVTe/svaNzx7t9cCXTIqBk70F7fy2o28/cYUUpealPU/rMePZfSHlaITir3mXZGMGug7tjGB86yFIod0Kmqxqger3Mnzy+x3tZvltQOSlk2qiSx8B2izGln6dEhv3igQshHrVaPmW5rcWgnWvhlRpYVHnGyKYPMO1cSm5ezEMYcnKd7VviixViK8QsMI1hTXqFJgfFiwHq+MJf91TxuibsVpAXCptaXxXkE5JXhloF+y3/owLNlMnxtVZLAePsRrJ2iHkF6HJMZwYmTTTZqqVu3mzNY35PhXzYqmAWA4kv8yLZO/s72YNm2mBMANWLkfKSzYoR6YJdpf8LSnRyp2Jqf7+IjePcwDq9fKrrZlrZfzFjGADtxmNUvP9XI8l3bPk45pcCPrdVl6uSHFGgwEjssOk2EessaZSdkBe4t+aYE0FgFOLdSy+w8M= X-MS-TrafficTypeDiagnostic: DB8EUR05HT231: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2aqeyvwGiFQD25xsDjyhVmVw8ysHfcEktpvWLj2B++g++Vd8mNIA8TPq+giDcDOnj9SzAnorQsMv35JwIRMk2tQHv5O7jje3uNDcuVw8AspFmX2A0J6KTzoTaMYLVrUhJNtnqOT2B0M55Ex7bPjAcWuRlpaQQ39gixkC8QHgkLa+BdpmO+s4eINLvFqNREWcslulu0S9fQNHNNCopc8hngB3i/ST1jvS+1CIUgWMeMaIYhHk9FMdX5cEiC51DhqZv0oTYZznCb76vSsrSee3N8ruuCd2FxbGMn02QUL4fjMEfh+Yq0qWzHBZZpBcOPPMiiFQ0h6O92lSoZd6HIYnwQXuBEmH5xm43Hm6F9FuWkGdq/3ii974cIEHXHUH4RQQLHCIViwz+0p47E30aaWmTQ== X-MS-Exchange-AntiSpam-MessageData: ySS4E1W8DLe7j4YxLDiWm27clW6PKSKDx96ENlpZmBbNyMdC0XikobnndZtuI4BN6DE9vgvm5xZD0eLypIIla54jw76PGmVzDwMolFvKa1fCG4RQIGXZBaxYWqIN6lYS67GK4qHAeQ8aMFunFlRGow== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82b827e6-d2eb-4231-ac21-08d93055f318 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:16.0868 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT045.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8EUR05HT231 Subject: [FFmpeg-devel] [PATCH 10/54] avformat/av1dec: Simplify cleanup after read_header 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: OyLxnnz1fqEl by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/av1dec.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c index 8ca804c2a3..f282477ca4 100644 --- a/libavformat/av1dec.c +++ b/libavformat/av1dec.c @@ -77,17 +77,10 @@ static int read_header(AVFormatContext *s, const AVRational *framerate, AVBSFCon return ret; ret = avcodec_parameters_copy((*bsf)->par_in, st->codecpar); - if (ret < 0) { - av_bsf_free(bsf); - return ret; - } - - ret = av_bsf_init(*bsf); if (ret < 0) - av_bsf_free(bsf); - - return ret; + return ret; + return av_bsf_init(*bsf); } #define DEC AV_OPT_FLAG_DECODING_PARAM @@ -285,6 +278,7 @@ const AVInputFormat ff_av1_demuxer = { .name = "av1", .long_name = NULL_IF_CONFIG_SMALL("AV1 Annex B"), .priv_data_size = sizeof(AnnexBContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = annexb_probe, .read_header = annexb_read_header, .read_packet = annexb_read_packet, @@ -472,6 +466,7 @@ const AVInputFormat ff_obu_demuxer = { .name = "obu", .long_name = NULL_IF_CONFIG_SMALL("AV1 low overhead OBU"), .priv_data_size = sizeof(ObuContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = obu_probe, .read_header = obu_read_header, .read_packet = obu_read_packet,