From patchwork Tue Jun 15 23:32:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28335 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4313410iol; Tue, 15 Jun 2021 16:38:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJww2wf+tZAnFR+gh0GqXYWemQIHpRMSrFfXxZcreuJpMKuvrdLFu+ibWVqXIUhKs/jj8xrg X-Received: by 2002:a05:6402:53:: with SMTP id f19mr732442edu.200.1623800297901; Tue, 15 Jun 2021 16:38:17 -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 y1si282122edv.58.2021.06.15.16.38.17; Tue, 15 Jun 2021 16:38:17 -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=HJyHZOmf; 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 E9464689F00; Wed, 16 Jun 2021 02:34:35 +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-db8eur05olkn2022.outbound.protection.outlook.com [40.92.89.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2057C689901 for ; Wed, 16 Jun 2021 02:34:34 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P7nAMewpKfKI1wW3ysvreIzkxueL0KiO9JlX1zA2cbhVQgV7wKlZdgBkggQS7FpnBT7ccWCozAPLpVptvys79PFUpuIcZ87LXE5jQliUb0vDPSNuhwliT5qQAQd+vMVt2geL843WjJAohvpFgpDEtNIR/HRENNMeLl4P2ACwoAekwuzUZdBQHa88ppj9pXTlqEe2wVtdA/DKBFpCe9843oATbU5PWyHXCNHvTnFvBpV3orKhoC5aG5aCO2JwEkSFrPZGQ4KB+gbjbPOiarocjux9LnLwblABYO2ngd0TxBY/lYiI9JU5ETjijB0YP455iXxEL5PUTVePrBQX5HmnUQ== 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=3NMc2sd3KmeFN8l0phy71oZOlmkWjUmCXGHINgIQ8DI=; b=fIAvnaHjweYlag4lkS0eihVfJm/PP3U4503UpyI+Vs9Q5oPxkZjNI5R3PxDml7UakB6gKwUzL/SqaLHr1g5Pi1JiXYjHxRJVw4Zg9I6pmkjIwcuT0cpWdurgJrJc8cgWbKu//I5BGbcj75WmrNZaHeJzQu9FVAay62L1/363FCKm3QVo0BGKEk1w381NCpDMv4gCjrUQpcDSYRAshFElNP4pNWqWxPwedsHG0t77kJhe7rW3Li0OhNZoN+vGOab3t10b8SBrCB582GyNxQloADo5NSYb8VSRNQoyjjiBwtISBen/0jhRDEhehtvXrFBt3mRP0Vy8o82oRDmjlq8NUg== 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=3NMc2sd3KmeFN8l0phy71oZOlmkWjUmCXGHINgIQ8DI=; b=HJyHZOmfBQmLpr0pigWwAhFcRyt/VDTuKC5/G6aLVsMYvQS/q2Zc3uyvIuoGzw2tI2M0MCMq4me3mizv1mw9EBAO5Z0jJH+r2tYgVycqtK/5v+X0kBOHLvEweEMvAa6kMc/uEwi9oTk6MO6jzY4ZS7DCnBMtsrHcV6Beiu3L3YYSSbPtMKah7t+wbgZnIjgjah6P8PvtMhCC6r/XULVvPLQugwjqAQ6frUuQIUtZnYblWAN1tSGqIH8Y99YDKRAVk+uWK0pZN+Uo6jvxpVvaEHZDz3fQ67kzph7JC1dmYQRsGRyFcLajCdaS6Tkt5Yy0TvMKgeN3xXX+aZDB/pOPBw== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4d) by DB8EUR05HT247.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::272) 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:33 +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:33 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:B1B7A3C0D2DC84AB2713184171538AC94A95084772127C7C2488F8C5ECE627C6; UpperCasedChecksum:F90E11A672F3F78304FE968AD9485127D3BCDDD1D7C6549561A3F69AB629BBCE; 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:33 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:24 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [baJh9I2Z3QRuj/Y2umSCWE42/ER1EQ9x] 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-34-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:03 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: dbb79fb6-7869-4b2e-3e55-08d930560fab X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjCyR3nvnqtBFob6iScERZNbTE39jqKA7JayuX2Vp1hjbL28NFEgMYqeUmNfWcdomYyYWlUHrgiDTjxHnReQc2otUC+ZoN2uYYJkjUZT3jL9vciMlV2KNqsxDSTF1642QUTnm3aadZaXnftrc8unLJU8xszYYA+/HGvsjkHajvmmwNC2wBbBahVVVonNTQUoP4MJZO0IlIq+Jff5Ei/uEUPP5ItOKoCIb8HWt7SmyNPd21puiCA5lGw6DLZk9RrT3bU2ZAGfkjHzLNNDo1bMFByAcibKlx7QkL2DoAXQYA/e11eRqcekszgD0fkVlVCiC6vzXoAQ/4FpiWZeQ5A4UK7pZpP0Yymv41QPoNFyvy0HwOtQEKZMl1eycGDRcxmDAcLQEg/kLyssQHOpQOQ1n2UQj3gKWKyS5QtiFxJYZ+fz0+aLCdl8z4UkqklBcimhf9lpymij+YUoSp6cOZVW+Qmn/I0FZYu54e+g8Bc62J4eMpSkvf7v9kEf761yp5dDVFzR7eSK2Cb/9cJ5wnkVGTyWAGNxJxvxiTiDrBODDO74Xw+/aC0vHxtOCfvl8n7pOSiccPQaVF+21GBEkvTApKafXciInbLv4PWHOm3lfH5KyIyj79dfXlqGCAHO1vs+1itFLwPcRTp/kjSKpv+/hslaVdlEZgfPYnFKb1PhDWjsok6kO2/vKfe9qEG/SJq+gbmjPJOt2HrVC51DctJcMqDs= X-MS-TrafficTypeDiagnostic: DB8EUR05HT247: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v1d8q+VpbjSixee0RxdRnXssnlXn5o/qhRhGwTbtokjIacyTyW+Sw4cU0b5kSbZWFo/kdjFBpLoucpD8qrwYhDkrEeChUwnxUEwA9YiNiVmH1capPpFTgdLBAvyaTdMTQHNll9InPhsqu2GkQ53SxkaacHc3zMW3hn2868IUFAJ0u2gqqcfGKKZDRhK8fcpnMKdW9pjeiNMvEpapzmVYGI0BVRDSYubylPiZzhQNm+PDNRu1xwVvjCA7nWi8HBpPdvvB5nll+lLFsG1vmnk7bh+J5SaK9SK57hzuuoXjiuAlTGr6EcmuJ7s8JNng7Y88UZrkd47qovONSnuRUI7vlAp7s7rbn3eqRLWXCfy8WopqO6LDapYLntKg7Xhiu39OyS0qTg0eoxeb29W3k+F1NA== X-MS-Exchange-AntiSpam-MessageData: sA3672HhIc2ZbT3KIpZ27vDqkiGEHzlW8aS3OFcleAIdlHOvpxHJPpQAVQ+fwglL43McsB6l1/jNZ/3zK7JoGIMyzWOtcIgAyn+xeRfND2PY0neuTwonUC0lQay6jjYKn4mk/r1lcP/hc7TgvB1rOQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbb79fb6-7869-4b2e-3e55-08d930560fab X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:04.0626 (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: DB8EUR05HT247 Subject: [FFmpeg-devel] [PATCH 35/54] avformat/pjsdec: 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: ljkTKbu1ylc6 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/pjsdec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/pjsdec.c b/libavformat/pjsdec.c index 40d820a8d6..1fc16831ea 100644 --- a/libavformat/pjsdec.c +++ b/libavformat/pjsdec.c @@ -93,10 +93,8 @@ static int pjs_read_header(AVFormatContext *s) p[strcspn(p, "\"")] = 0; sub = ff_subtitles_queue_insert(&pjs->q, p, strlen(p), 0); - if (!sub) { - ff_subtitles_queue_clean(&pjs->q); + if (!sub) return AVERROR(ENOMEM); - } sub->pos = pos; sub->pts = pts_start; sub->duration = duration; @@ -132,6 +130,7 @@ const AVInputFormat ff_pjs_demuxer = { .name = "pjs", .long_name = NULL_IF_CONFIG_SMALL("PJS (Phoenix Japanimation Society) subtitles"), .priv_data_size = sizeof(PJSContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = pjs_probe, .read_header = pjs_read_header, .read_packet = pjs_read_packet,