From patchwork Tue Jun 15 23:32:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28349 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4314518iol; Tue, 15 Jun 2021 16:40:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyn0l0LVXDBrklr57bnat8BMdPZQNAy3sXnCOpoDQH3/7Zf75f2wp+p8J6kcqPkNAwPGcS9 X-Received: by 2002:a50:a447:: with SMTP id v7mr702416edb.183.1623800415116; Tue, 15 Jun 2021 16:40:15 -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 b20si371242ejq.607.2021.06.15.16.40.14; Tue, 15 Jun 2021 16:40:15 -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=KUZ7aGMv; 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 9A84068A11C; Wed, 16 Jun 2021 02:34:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2085.outbound.protection.outlook.com [40.92.91.85]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 25B8E689FD6 for ; Wed, 16 Jun 2021 02:34:39 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zsjsen571GxfQb08H0J6W9O6a5z9hzSbdHbEhm9hPOiffLFKHCxqIg3QqKdb4MSUkWElDwvlZdsh/czd10OB53bqtKc4oeGsud8JGWtF1SKz5hgW6Fx8wPEyQURnCVTUujgM6BNoTMFo9aj3UGaVE7hGj+Bfz+UQVkWfkPTI1nLuA6Imvnt5RVKOthMpN4Wvf3INu/hFS3I8MACXMbqDs1d1dAb26xuxDo/PhOL6AAYSSgtPEYKLkUVPkwflUKeQoJjFj3iy74dslWilWWkrG4nvqYLv8sLzUL7PhMHNctIj1ilO7IPldgITKXI+iGYCJ+YN6YckTgVBLbJPNl5p2Q== 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=YUCcukrt3xcJ/ALWk88YJUhM3TT3yN3MNFP62pwcEz8=; b=KMrQNzPjMJ5N9oYXazA2JaPXUqHAE16GOAIWEWoyHT0EmbvqBctRbgd4QbCpwBwkqiLucXop/Qk6siVGgIBgG8mp/BS0bbjt2L6bGoL1lWUvLCHsKZcj2+7h9QjoK792U1UeaOGV59ur4AvVLJt9JbFEYNsT6fGJrc7ylhCp4zG5e3lUh0igFQzq1c5LmzYAL/gcMoC4w648QHEi7Pvgs6VgckmYJxWt+4A+kYaJev5ai2R/mMmXqs4rrcCe+bkf+TDi0GRbBrZBjgDR50/pC7ulegtu/rOnk6MQJKYf6PO3SelwSbW7568Xhx3r8MqGtV+vabVc5CVQhi/M/V4XVA== 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=YUCcukrt3xcJ/ALWk88YJUhM3TT3yN3MNFP62pwcEz8=; b=KUZ7aGMv7tLnIytrU0FlJrk+KfIk7c4a9DJJ9CyeE590IWni62QEizun1KXAta/vkEZOnkoY9P5TTpDszSMFMB4lgLDv64dZZf3x2D+6IbMUvPs08fRzOn9SXSBkHKhv/SlLL3bUjHkB5W4pkUI6TUHk4BeaogkN7t82vU0q3RTUXVtX/cEDTmByT5Q1x4Hs9vkr1705Uvy2XiQhgFw2AryoJxx7KsPAYTMBK9P4ihy16RMNhj0qaL6NOg3K8o2fg/G4jazEASUcrIBKBF2yDKSfLtbLskS7Lecw/lZYK0y+8qeDlOS77zsx8+P2nCflau7zcpNlgKBpd01npgLJ+A== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4b) by DB8EUR05HT068.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::259) 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:34:39 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:fc0f::45) by DB8EUR05FT027.mail.protection.outlook.com (2a01:111:e400:fc0f::448) 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:34:39 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:23749EFCFDB25BCE1D9B073446B1AF36FA9031F0D1C37EBF412E0FCD11746734; UpperCasedChecksum:ADE8D40D4CAD7B4D41E95D3CA2D740CB731E754E8F7D5CE368DDD28CB16648AC; SizeAsReceived:7771; Count:50 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:34:39 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:37 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [0U3AQchWQde1Q0UUkA20u+TTISecdl92] 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-47-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:34:26 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: a81361ff-09ab-4aa6-c788-08d930561d99 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n4J7adcKN7I1D/KNbKk1i1rHVYeLII6YMM6loz4TL7ROaB7Ww1Gdz+wu3WMI3ihqZdl9eiQq9PDNJ5RU+X6XILIUO/g1si1LTMMIMeSBnTm5liGnLJHPygcZ5MvEKpNJgnyboJ78OL3rKhnJKZqj7cQq+BaZQuxCaN6QK4kCnpOrceDCCLVz1MhanmIbUT+Zn9Jn340FC89QN+9k08/fUga48O6umm1BPpzHZasKiv4hnvaf6bTTnaZb1i6puB8VtbaeiOwd4VxD6U90BX8U5i5iZvkA9hcRL+7wv0upkX4gawj22GT98KF8Ww44IYksOrjYUizUugs0Wj0H/jYYcHFRW5gWTRG3Dv1iBMbLRUplfuLzupD/OyUOIpjBHOJvvy2AvvIy8vPtBg/WgKPXNTYVin6XFJi2kSftZbzO/qJAGJDKdu/JrtdecjQ6D/E9GQc9OCSvZpKXLu6JCe8X7DrDOsqflzLnKRmyctgG1a4jhbNGR8V9KaxcO26+vijLKs30vaQxsYPCWqVxPd6YcDSay2h6wNHv32ogCOi/Ej3JmPMbbOzTEXvm0APPAbrNn5XwN2pBv5fue2nrlLbytccyNo56yNASUTj79ToccDEk6V19SS8z7ayakzJvytBYRcc58T9D3GPKG3wuZmd9zJsbu+W36IHLNY2LNGiUvMQILA78EovfcetOJNvpVnOKoGwF3JF7ENEnYxokf4RkDYaxvyB7x5g68w= X-MS-TrafficTypeDiagnostic: DB8EUR05HT068: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Zbh11hQ8GBY+nDYnx4TWeNkStnp4Bvha8e8utOt2+t+i1N271I2mUITpTQPmPy7PqbACKPLB65Z6EeI8dxV6CwDRo0JZLfwkbDpHN+CnaomhU4nn8B2just2fzJRrH7mF+yM7YJtJsdSFT9ctVmXTfrCF+/TTH1Qx1o3M3+4V3fOjAc3b6zYXq0J6Z3uBWdJJnXx7z5mwBgR9Lt+AZhBQtmyuRX4P8XDqo3djSmqWW+23hu8fmowHCAJNSBl+82AiwXM/271MVEaTIRn/rSgSEC/dqW+PgsalDhVe7oRepqXy4nq0gFQCNLkeCjuR1MB729qtDL5WcORfDYdZg9pJdPqrebTOOPzvKfpW6SDpDD9S9c40vb+AxgZ3vIapERnNC1oUETlcEP6WmxU4B4IxA== X-MS-Exchange-AntiSpam-MessageData: gL9xoyRFZTEufiX1+0PBMrI9Yeoyweutv/eJaZ6Z98b8AFaoJr1eZpSFDVnuF5n9l0cwBwrRFJr81V9cqB++ithsI6xE1q7AVz1+KYjwV6u2e0jnHHDPtO4pKGPNFMnyNWGPMG7EYu5DOCUWhbllMA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a81361ff-09ab-4aa6-c788-08d930561d99 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:27.4012 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT027.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: DB8EUR05HT068 Subject: [FFmpeg-devel] [PATCH 48/54] avformat/tiertexseq: 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: R39Vc6SLgKcc by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/tiertexseq.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c index 164a75bd53..ecc15e4039 100644 --- a/libavformat/tiertexseq.c +++ b/libavformat/tiertexseq.c @@ -202,20 +202,16 @@ static int seq_read_header(AVFormatContext *s) /* init internal buffers */ rc = seq_init_frame_buffers(seq, pb); - if (rc) { - seq_read_close(s); + if (rc < 0) return rc; - } seq->current_frame_offs = 0; /* preload (no audio data, just buffer operations related data) */ for (i = 1; i <= 100; i++) { rc = seq_parse_frame_data(seq, pb); - if (rc) { - seq_read_close(s); + if (rc < 0) return rc; - } } seq->current_frame_pts = 0; @@ -224,10 +220,8 @@ static int seq_read_header(AVFormatContext *s) /* initialize the video decoder stream */ st = avformat_new_stream(s, NULL); - if (!st) { - seq_read_close(s); + if (!st) return AVERROR(ENOMEM); - } avpriv_set_pts_info(st, 32, 1, SEQ_FRAME_RATE); seq->video_stream_index = st->index; @@ -239,10 +233,8 @@ static int seq_read_header(AVFormatContext *s) /* initialize the audio decoder stream */ st = avformat_new_stream(s, NULL); - if (!st) { - seq_read_close(s); + if (!st) return AVERROR(ENOMEM); - } st->start_time = 0; avpriv_set_pts_info(st, 32, 1, SEQ_SAMPLE_RATE); @@ -320,6 +312,7 @@ const AVInputFormat ff_tiertexseq_demuxer = { .name = "tiertexseq", .long_name = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ"), .priv_data_size = sizeof(SeqDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = seq_probe, .read_header = seq_read_header, .read_packet = seq_read_packet,