From patchwork Tue Jun 15 23:32:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28392 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp125827ybk; Tue, 15 Jun 2021 16:39:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/O/ohMm9qg/XEIj7tqt/gCGYqorqUogmzXdlwNW86C5HAk/KaiP1V2uvGDOt0LZZOwIc7 X-Received: by 2002:a05:6402:254d:: with SMTP id l13mr713763edb.286.1623800344656; Tue, 15 Jun 2021 16:39:04 -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 13si413339ejg.731.2021.06.15.16.39.04; Tue, 15 Jun 2021 16:39:04 -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=WI4XAeRN; 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 3F051689903; Wed, 16 Jun 2021 02:34:42 +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-am6eur05olkn2090.outbound.protection.outlook.com [40.92.91.90]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4C6FA689E9A for ; Wed, 16 Jun 2021 02:34:36 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ivxSOEcWvZZi+V8NIY3Pvv3/hqMZU3Yi9EQeDbXiJRT+KLe6FVBcptHJwnyUPlmuWvIgT3TzhOEDMmebPKE/cRIlN9LbeZ5c0/BCo3rXwCdJsJHcieJ59v1JLI5ktK7jTgtp0z1ufPQqxAxEDTNBjlD77LtmgzzQUh/BU9B9cR10oq+6eWGoka76pGql0ms2E7vPkjQn2k25QZwNnnpDLlLj+TVKspopg6WLSDNtKeU7w/olCUb6Q38GhV6WQFRBRHLYamq/OOdmTM7kmgGU6xkQKp2VyS+6NsHyS/4jOII+7SUzmfZc5qeE5mLeojhXK98EnGKh/fqZe1Uy5KX9fQ== 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=45cx6L/tQiRKWgab5O/PENVVWXhXU2Y71op+yvKRwYA=; b=Uwl9a5NYjFYyr4M9kNU+5oNbTreN3dBpHoI76hP7lFzM5wvpz543RUKoAEZTjUojL8mDs/xmjzwfNrtrL6+fg96VII5WCzxaqLN7MpdwsMvgMj4U4+65HwIfFVPsl1LugdvYFHYXL4DfTRyAVKMHNcW3rMQSGILUx863WgAQfvGIjh3PpJzZiOcRiLRoRMNYFDk/Ijc5VQm0RLlgTjI5Qa0YxJ1fHCHpFkXnRz/1KFmfjHNhBD+0WzrQ2ka8HK3Sutdk/LCXDH/+JcA6RgyHsQU4mWb+XB8dlEpkj+csqAvIVqGSXGj8ay4Hhh0urcXlcNmbhNmLiWfFrdhXvDQc4g== 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=45cx6L/tQiRKWgab5O/PENVVWXhXU2Y71op+yvKRwYA=; b=WI4XAeRNM9EKg5Xme8IpXCSLwbi3Qa4wQMGmDewC3jCDHaFJypSwywD4NWpCQdpVL7Cagf4Lxrr+gGlUbXEJTWZF43K/wSaR7EXTStDdtA9NQnhVz1Flxaqq8Tu33cMdF1I3Pb54/RHQwMG8wIXSIPVRP6KuMch3R48Z+D0f0hzPDagXzJJQlRHePV7FLyCHYlzSKNJfz1uO4qisU9aZKLh+jn72j+Zakjv6GDa2bYIwFZe9Ggchs7B2YUAtVXg+sBKI56NZQwkrTI0wWLofmXhjz7xQW9xJq4lkoLJwlXL4l7+bbsAMy6fvlsTv2E9IzeX/Qp3uuLnJWVkhY+DMnA== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::48) by DB8EUR05HT062.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::258) 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:35 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:fc0f::40) by DB8EUR05FT030.mail.protection.outlook.com (2a01:111:e400:fc0f::228) 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:35 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:DA6762351F6EE476E12BD152D20D6D1F631A10E5FC12F7750B11428414A3D2C8; UpperCasedChecksum:6C686A6A4AE78088F0B7BD7F43360A3F26A5364C993A257DB5977797E55EB9DC; SizeAsReceived:7769; 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:35 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:29 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [8l8A6lkgCAV9iMf/b7uTRfhr4LZk5l86] 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-39-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:11 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: c19d2112-8096-4d6e-e1e5-08d930561464 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjES5i7NcTDYEwSrIFD5q18l6MMZpVzRwr73uWay+0YiWGMkxB/DTecdu9DoIgdL0k3biQF7poJbppvs4eC/LlOj4twOuJnvCVLSKtG6sijNv5m/ZpFBV3i+r9vQRJtq0jzPT5cUePLMEIrgGQ+ultd6BjFMCxwxMLo2SvTG0rvTqLvEvNrPiIwySIjiZpCft9djDpl1t7NNZ3n7yGCLGLmWL6g9fwUDRqlyNo/8+6Weq7TMUwGTpelS64w714JDqi/BEt5C0qE+qf41Uhpbi/Vss8PJ5qNWcWbfl5C/0sZK+igdBDzCb+aQeKgCwymHn/HZJkyaThXVU7taAuhUKBsemPMFDxNpvVoriiuZNpPuCs0HDmtOx7Ofwa/9MfEC5WeQUaAilo5IcFDrif4Ab28GlSg9IzgIXhkKVaLLya2FPVJtja44FeMVjNFbstlVnXYS8dj5kyE5Mf8KbhJ7/Uj2MIQeU8lMVRLR32knjxAKFF2D/tjid9pEYpmdN4/MFy11MzaxjL77Cv5ZOr8GsYHMjtJ1Cgeeeo1+2TTRccWWO5yHSWrqCDzN9hw8xgia4hQCT29+Qt7zXTb8BHq+4tW1eeGvXPcOPt9Ixtq+pkTsxGJwHG+4RLn+BZeYvlWKvbRyzUeKzAJIvDLmtqBNOlXOrPtcygNbnJzT+1xYUqT86oiYm6ng0/aHiYUfTAmc2dvh/IcjD6fazxj8hvrNXFrI= X-MS-TrafficTypeDiagnostic: DB8EUR05HT062: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: awlohQsYOIBoT/MDudFN0zy8I5yVMk0H6dQEPcZS1kUaE88j4xrCXC+pGvLGej3JpPRaPFaN5E925OsfuJ9cI8+tRWeEjxKiLX2yn4A2sB/QfU6xU6A2ZLLCGuRZf+zZIQbJ1Lt4jEg9TxFImS9NjyPVkCdgH50XxEKaLzuxnzrIrbqdnwlaYbvyzqcJQ1qXA/EaiOubUH4rKPiNUh6iltGJPWfBCwc2EKd9xtVIDl0wKlssOAQZqUiP9kvveQo1/9bCl3g3AVzJ02SLWlQRT6QVzmf0UYce1quydbxXakIZw0eOKtDxsBCClK/OxHCDRXi6pQUGGwgQTkd16IlzvrQiRaoblFek7P3/ttQKKDd7rY1bUaEcWjdrNIxxFhnKT6dKMlfYk0qb1kENBZGV6Q== X-MS-Exchange-AntiSpam-MessageData: yWckfgmVsY4nZ1uvkwlyZYhdaI9OOgxGdLukOOb8Zk1bA8NEl1Kf8Ob/Af4ajTqZ91jf0n2nzDVtbMJegDmcFW+ZyTvcAkoPBchOE2/motp4S5d4RSqfCMVQsl/XVuJMA6ZvXsN9JauZqf033pS1ng== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c19d2112-8096-4d6e-e1e5-08d930561464 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:11.9591 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT030.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: DB8EUR05HT062 Subject: [FFmpeg-devel] [PATCH 40/54] avformat/sccdec: 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: zfPz6KfnJrWo Content-Length: 1813 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/sccdec.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavformat/sccdec.c b/libavformat/sccdec.c index 5ad21a1f8b..e59e015bbc 100644 --- a/libavformat/sccdec.c +++ b/libavformat/sccdec.c @@ -145,7 +145,7 @@ static int scc_read_header(AVFormatContext *s) sub = ff_subtitles_queue_insert(&scc->q, out, i, 0); if (!sub) - goto fail; + return AVERROR(ENOMEM); sub->pos = pos; pos += i; @@ -164,7 +164,7 @@ static int scc_read_header(AVFormatContext *s) sub = ff_subtitles_queue_insert(&scc->q, out, i, 0); if (!sub) - goto fail; + return AVERROR(ENOMEM); sub->pos = pos; sub->pts = ts; @@ -175,9 +175,6 @@ static int scc_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &scc->q); return 0; -fail: - ff_subtitles_queue_clean(&scc->q); - return AVERROR(ENOMEM); } static int scc_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -205,6 +202,7 @@ const AVInputFormat ff_scc_demuxer = { .name = "scc", .long_name = NULL_IF_CONFIG_SMALL("Scenarist Closed Captions"), .priv_data_size = sizeof(SCCContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = scc_probe, .read_header = scc_read_header, .read_packet = scc_read_packet,