From patchwork Tue Jun 15 23:01:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28317 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4289031iol; Tue, 15 Jun 2021 16:02:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTtLJv3dREj9Sr8hc8E/U16m9RpDNCT9x2mnhC9J2AofkVGzUbl64fUBNoTxtcNVB8vW7b X-Received: by 2002:a17:906:d97:: with SMTP id m23mr1951813eji.392.1623798157291; Tue, 15 Jun 2021 16:02:37 -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 f12si179431edw.443.2021.06.15.16.02.36; Tue, 15 Jun 2021 16:02:37 -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=pJhtW7Pr; 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 56FAE688124; Wed, 16 Jun 2021 02:02:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2052.outbound.protection.outlook.com [40.92.90.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B5810687EBB for ; Wed, 16 Jun 2021 02:02:25 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EomBrZ9hGTw76ZEWBySxR7/w362wvZx4o37kAaNhGqcEOfyTJI5kNAWE1Iijig8d1i1bHA4/h9DDl/MXedZjI1OXzS2du6rYePLjnL2JMwiDN2MGzuvT2bxxQe8YmCYQdfDKNw+twww8DQ2E3Hiv+Z8+Z7F//uJshazTZnAaOC1wrHMAywd7hwofI31JDI1A0uy3M3N34/bj24kR7C+HUcmLl0kPaktbDLueZFzJvQfiKNyVxVNuGF7swby8AUIwTY42V45vxF2kzoe0TECvDlorl4hKDjMxWpuxWqzUMjxfokiak5x+Jkkmhn0jAK9titxTFq078+J+qOc/I6byfw== 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=8khWXV5oDDtp3rHzk/+yYJzbAelwOe55XfF6Fz09a/0=; b=DkISLHWTH2i2Iux8JPOhoZ5l1VuggnWZYTf8yZDGIDLvQJHm5zDAJ1NZUhlYhKGjpGzukIJ2d7EcDFmB8AU0gZZyOf0Bih4xbMnTbtNnaGtKE9+sdwwMo/W7DnIK/l0iu6Ny3wFzTfMKAFv16JoE9dwE9EGjxRwvV7Mjgqj6Njzv4OEem6N4seBxWiVZHfDk4d9XfVqNKCAtVEGyUYuReZATVAsF/CNB/kSCio/vbirK20eiTiGqr/Xn27bmLrNtwPVXTND8cb8+r59/CVlE/QgI+3n4h29lT3bqGN4gvPk1Kzn73pSB4pORhx6oREDHTBcQx3sF/S0XKnMy0Vg2pQ== 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=8khWXV5oDDtp3rHzk/+yYJzbAelwOe55XfF6Fz09a/0=; b=pJhtW7PrlnHh0p/HMdMSqj315DUK5COswTEzoFzWoguDhdsK0MleoNrFYAN9kZyJyVJWDAOHEkYuHtMpGIawlSSmtYbBZyYMDSDNNWzSZp4NDN48FtwvqE5jrdOzmrAoUd7RL2LQ+jEJ7/EE/IF88WlOBhmpFSFplvwRahI1IGsfuFAR2QafQD99FOT0HLVhTbcRhDpz+m9DpOUZh7AA0R8ca6xFvG5XvfuqEIxMC8XCcWn/BsbjknFQrPkuEMMggsNAJHxbf4GNS7lf/OcGnuKF4SY42QWjF3+KhNkpeeHI3XOtmODbjLepa//Mk+RROQo2M4bYNuFxe3ZWe2/X9g== Received: from DB8EUR05FT006.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::51) by DB8EUR05HT248.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::227) 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:02:23 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:fc0f::4c) by DB8EUR05FT006.mail.protection.outlook.com (2a01:111:e400:fc0f::162) 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:02:23 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:3FD0FFF6308256AF9CADE38EB2DEA6A6FAB5E077C698820DB850A8EC22514E72; UpperCasedChecksum:79FD277A3E34A215A52AC0650A0D54F4CE640A70290C0754CC7F0ADDE143D4E8; SizeAsReceived:7389; Count:46 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:02:22 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:01:18 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 X-TMN: [yHgsHmI3rve1J0ARBrlfweeJMFlWZytx] X-ClientProxiedBy: PR2P264CA0043.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101:1::31) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210615230211.1173416-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.97.82) by PR2P264CA0043.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101:1::31) 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:02:22 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 67ac1dd7-9ffc-48e4-50ce-08d93051a251 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNU6vmsC8bKdN9dIlRoJ20bm3dTCv2UohWyieMA44hAHSa85/5tXeHYv4iRatLIqXvwIZsxFoNraP/Gef+jjM2EdzecUWpcDIVFXEYsiYB+QpMjQ6YC/tLDuD2nsqOZr5noHVAbmdR2zHolcaCAXcu28eBOQVgdxvcB7bwq+WAuU29t88EJN3dybIlZARUrhVokH5SmkGGNlkNFZpeAuoKZ0ZkowwJZfp6PunEM/RC+YMLkTNyKfYqYJ6/QMZUceLHcqB2UxlSrs400dqIOWyVoMFufaiyHXBusShQUYkKns44gwgS2SJW3I8DNJbEKAkj5R9SuDzMSjzMJT9APmjiEbLTH3QbSCAVKMGkHDV+/cUrbnbafXlA5VrCJE+kBM8x8XwcuvZk/7fL3J6uavjs+SdoXmZVcfEwZKbXpk4sbnKyU1Qd79FrCpBsDRcHTlLawOwGUYNBr/00xy50IusX8wc31QNk9srNfsF6cHwiIsLUsoSq39A5smDkx3pnrbM8NNQ927asymzsG7b4Q1zxuJ9FH+8DSpXAoPQqRsNSbhw4XIRDY8ADEjn6aBRqL9WyczXjTymoiNf3NblnZuhnJnYMK8d+35VkGf3tgVI9GqST5ttQkwzAytYJL0mHf+C1WZemPj6olUkd/3+LAZEH/26u1s1gam3kkm8r/R7v3MSrP5p6o6KGkwkpG2kG7HWb5NgVqKyvCWYSvUz27pbFC9ah2gdoZgLNI= X-MS-TrafficTypeDiagnostic: DB8EUR05HT248: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: emwko9bGExarNczRNRhuEgd3CiNCUQWPcCCLOM+O3lPGn60irW7teT1HXsb2VQb5B012KoSGVN5y7Fj2PriRn3gnygoRJ5ktv2Vfz2XAJo+zyyXypPywUbNw4kztpDLnSX32hlgnw4Uljk4F8nw/31ZLM1QpR8i9fTwncmdsTxs2bCmgWt12L0wS3oaoWVIG/tyND4ViYNG7XNHxnsSuntxNRry7cUzSIVj8QPV1lu0bKTtLty+VJ9J+Q6rNMFGD5oFrk/2h0Fc0icWpmTa5CcuaUJF/otNkZpiN+/fU1riNJnC+nC3ZrjgYnQRlOPhwLzsorWbcSeH8rTXQLQHLVQcag1q/TIz8dzyvd9fFgMn592i0SBUNqUqpYktl5MymYiFXeygLOTRC7VcaMptmug== X-MS-Exchange-AntiSpam-MessageData: ZKfxLApfy+T/oemfcLkJfnQ2Ry99iu83ETXNdEg4GdagSF+NJfOkbo45wuZc6/+YnouN+I3ygX+hrld8Dczm7FzAK1i+kk+sTH3g45XRHo5y8FYeNwh0tWvxjdYg2iFAaxaOZGtKQKO9OPNPEOYwwg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67ac1dd7-9ffc-48e4-50ce-08d93051a251 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:02:22.6996 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT006.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: DB8EUR05HT248 Subject: [FFmpeg-devel] [PATCH 01/54] avformat: Add internal flags for AV(In|Out)putFormat 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: iYqcAt09FeHj Both AVInputFormat and AVOutputFormat currently lack an equivalent to AVCodec's caps_internal. E.g. if reading a header fails, each demuxer is currently required to clean up manually, which often means to just call the demuxer's read_close function. This could (and will) be done generically via an equivalent of FF_CODEC_CAP_INIT_CLEANUP. Because of the unholy ABI-relationship between libavdevice and libavformat adding such a flag is only possible when the ABI is open (despite the flag not being part of the public API), such as now. Therefore such a flag is also added to AVOutputFormat, despite there being no immediate use for it. Signed-off-by: Andreas Rheinhardt --- libavformat/avformat.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index cd7b0d941c..81d2ac38d0 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -535,6 +535,11 @@ typedef struct AVOutputFormat { */ int priv_data_size; + /** + * Internal flags. See FF_FMT_FLAG_* in internal.h. + */ + int flags_internal; + int (*write_header)(struct AVFormatContext *); /** * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags, @@ -674,6 +679,11 @@ typedef struct AVInputFormat { */ int priv_data_size; + /** + * Internal flags. See FF_FMT_FLAG_* in internal.h. + */ + int flags_internal; + /** * Tell if a given file has a chance of being parsed as this format. * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes From patchwork Tue Jun 15 23:31:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28320 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4309921iol; Tue, 15 Jun 2021 16:33:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMYYqdYsOEa8v2t5CFr5DsgDZGOruT3bXKCawLEReQ6gFdt70fMYoIhF7nwjlsSIv1J9BA X-Received: by 2002:a17:906:9512:: with SMTP id u18mr2083721ejx.61.1623799986481; Tue, 15 Jun 2021 16:33:06 -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 m17si434663ejn.202.2021.06.15.16.33.06; Tue, 15 Jun 2021 16:33:06 -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=ltcUgSAL; 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 10B29680454; Wed, 16 Jun 2021 02:33:03 +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-db8eur05olkn2072.outbound.protection.outlook.com [40.92.89.72]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E804680454 for ; Wed, 16 Jun 2021 02:32:56 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yo/NZfmowjgy0sDSGkxuZRtKDmNtrofOgaJHxnvTkAEKya0mGYdTnyg+FKJV0FVt1iaGEdMcScoIpXWncnzzbj80swOnJfwh3LtULfLIGlz7m5j+pbyBfp5BWk3oWMnnwEU4Hz5fft1I+Kw62e+0SIq726faTbEDMLnC62tGQmH7U4v9qv9UknG8beNOfuv815ZanfZS3xQfaOhdCg2mdnOgpPLI22yHZ+FzpS0d/Q8qN9qcFi4Qy5+8YgMYc89bH0B/q3fASxcaLQuKx6nPtE8tYF+xgEmwcfRHNchQ6g/oI7exvuKKGgclt5qKKP0l44OIW83BFhx7RVtsfW33LQ== 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=QiXWRT7s+7L3c3yrbH+4+tRm81rCvtXfS5k+9ziTEyU=; b=QBNH3KuFxRKD6VbN1JEkTTBS/1QwIJ9//TC6Y71f8Qc/BlunRNrEr/ZbMwIhBGWMgg0lL/CSw3ALCEsdXb/7O8KwVpGdEiioQhpJLM2SIc2zXxUI/ld2tgDQ8aBjIJBWuqL4RbZhTRyT+SoEFcrrluwF8a+1h9GoOAXAmJbX0ys9BIkZHZyt/ECqgUSZHp5sZ97N8UiiYnLVidMEUeIQCPcV0vJ8xIQ0t4UbH1scZSFOB+ZKvbG9XKDYMpeB0gCjWHMqUhEaU2gaw7baaxeO4CMTcfXZIQmqavzWkFmsRjAMEx+omAXFX3AAweM54mywRPYYE15h5db5jZ38Wxrw+w== 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=QiXWRT7s+7L3c3yrbH+4+tRm81rCvtXfS5k+9ziTEyU=; b=ltcUgSAL+P/pt2Yz8PZ1gxcSCB1wlyjle2Ax1qT6k5M5/vQIe9oGIbHRiFeBWKTCqjdeY1dWRLwMD4ZgbIFs0Zp+bCr8s1X2IWhk+HACUmYMedVfu7ep4hm1H95CBf5WU6bm/K/QPOfObfmRaikmCi8M8qO/lOC8taFaksXIJxw1vPTBt5euS1TzVmhOpVh4LTOvmWogBx2sbiOwW65M7cKYSnn6cy4BXpPE/dyLuAO30i3zdeOBi4hUQfKFg+tWUYyhXZ/lRYZ0kgA4fTOAAayYOnDoKpa5JuIytTBPeMhC9ugF64zB0/th0OD0UdIXFbUsWs5c4gyqbVxaLoQRzw== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::50) by DB8EUR05HT098.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::349) 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:32:54 +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:32:54 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:F96D86A134255E324EE0298A6021E3C462B989CD25AE8D1DEC3BF864D08DF51C; UpperCasedChecksum:CE4DA5FB81747A1CAD77989075182D091039422B325F10D71CFEA3276B8C8906; SizeAsReceived:7594; 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:32:54 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:31:51 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [F2HJ3uM8AM9zjopWkkh1hE5Dq+v6+Svu] 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-1-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:32:53 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f6a2a052-7a79-4ea6-85f3-08d93055e62a X-MS-Exchange-SLBlob-MailProps: pt8ZUcDWjMXjm5E3BZqscgkJYEZiB9+AcR3tJ/v1IvzgaCNDvibnPnxrFFF5cRPL0hBOM1lLkA3dST+zkvvSiQDU290LxM77zgPm9vNDinaW/sxRst0D8Y8w/Cy+ZKpf5kt956lPmpiremOz1wQtIyBhMm4JQbrqkGln4bvWmVzK4RnUgi2qj+wIZ6/Roj6gYHbxtJJMyz9M7dSYFlNIbrJGwNGbNmjEp6BaSfzM5BJtLTazCDgI67oGASD5WY7XJDQu1fkEhD2y0on/F2Oq+vF33K+q2ZbC2OeC3BJwDY8FyNl9SvV8bEY5MBW9Wq2OouI7M7JhGYGTg+fZ7xlyZEbIqcbnJnwId8rgb7U3b4jsBkHhBVsNcnmGLxVaiwwddu0S6cn6HE69o5ebhFhlnANqMVhDMqD7diruqLJhcLH2Ap119fqbD9Ei9HHGELxBhOr/ZK54joQJqBdXmIjsXdKkdZCAlNUPiKGeEQypLgIY0W231x0xsWAbpI7NSBWjTVWUv2ia8KTKrjIzHK7hQQA/FW/VCVnKeocuCU3O45vSFUVJAKjiotceJHY5Ie3sZg4iGh/z3F3oNF9WOY1fi8omOo32khPJcZ0mqnMjXyrOV87U7KCBSkzKFdv3TDr9D1LV7pKIhes40PfSfg5c9wZUmz/WvfbEArzIPGDKUS5BpfEeH/6G175KBLT9gKq+x2qMGX7s7pWY9WxCSZ1lDvu+RlfpQIiTgJEiis+lovbI5nuoQoKV7Ha+J/1C4tuOScRb+yb1vkKLHZUoj3J87US0/HwYYPMUW111Po5dEyDaJhyEKrzwmnLeHnzHgKmJUumsm2kfHQ4Ihy0V19cqJHKUUNuHALYsQqMn+LJV3WSndwPyr1kIwubCQKYdk4E/sUDjy5UMGT904Cv/vOjZm/Z/lPgTpsQmP+5jZIsfC3PO9bH5OkyeyposykIUk938 X-MS-TrafficTypeDiagnostic: DB8EUR05HT098: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gsT3FNp6C9wJogZPSk5ouHWC8I1Mo9NluLgMi1KHMyvkIXRnbjHzO6fnVaXRu0HRCoCsExRZ5DsV1L9Gp80AYUl+pgslAAnpTo+sbUlVFx4ri87kb6jJh/s/v3cERF0Z1PEHzEkfIEn4AoTOU3koSwXSh8p+DAFiNo0lO9oMO3WFOmQCcqx3FkT4Cori2Nwz+3FkhOgWMCL5cnXARgzK77BDkfxRAp7rDuK1bWhaqYGC7foIy1L/eWoAN/rgCROw2XyjLh0O/7IELUy3cbmd9tOd9S2xDdOuq2+brixOiShv4YZZ5XAe/yCqn1uqOyTfHklCCmxZpe2kLvloVrgXJ/EcDgIxZeaBRmfdPDy8/eLPOXpNI9laK6wE9Fznek3CX+xlKn/AGcjvyldFeDbS/nQ0pG6E/y7KEdD0DeE6eR5r/r/Rswa9u+ZPg7SVfrMQT0z7/Q+A81Gu1HmTyfDtdrQ7ZfwZGRGzIKqZnYruDU0= X-MS-Exchange-AntiSpam-MessageData: 6PlUh4PD/reHldmz8anvaFDjE/BTt083PjacMeaTTZ674hVsfQoon1ihxi/IhWWzJZDzgNoGV1Vc/CA9O9UbuYaXRCvX+yA+VZAVYYpP7utko6Dn8vFbi0boZcjExoEeLhkBEZtaeT5X+BWnaJsHWg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6a2a052-7a79-4ea6-85f3-08d93055e62a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:32:54.4654 (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: DB8EUR05HT098 Subject: [FFmpeg-devel] [PATCH 02/54] avformat: Redo cleanup of demuxers upon 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: hSii8gc8FDR+ If reading the header fails, the demuxer's read_close() function (if existing) is not called automatically; instead several demuxers call it via "goto fail" in read_header(). This commit intends to change this by adding an internal flag for demuxers that can be used to set on a per-AVInputFormat basis whether read_close() should be called generically after an error during read_header(). The flag controlling this behaviour needs to be added because it might be unsafe to call read_close() generally (e.g. this might lead to read_close() being called twice and this might e.g. lead to double-frees if av_free() is used instead of av_freep(); or a size field has not been reset after freeing the elements (see the mov demuxer for an example of this)). Signed-off-by: Andreas Rheinhardt --- This is the new version of an earlier patchset [1], [2]; this version takes advantage of the open ABI. [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/258830.html [2]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-July/266575.html libavformat/internal.h | 6 ++++++ libavformat/utils.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index c6adf7b872..240de9e289 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -42,6 +42,12 @@ # define hex_dump_debug(class, buf, size) do { if (0) av_hex_dump_log(class, AV_LOG_DEBUG, buf, size); } while(0) #endif +/** + * For an AVInputFormat with this flag set read_close() needs to be called + * by the caller upon read_header() failure. + */ +#define FF_FMT_INIT_CLEANUP (1 << 0) + typedef struct AVCodecTag { enum AVCodecID id; unsigned int tag; diff --git a/libavformat/utils.c b/libavformat/utils.c index 0df14682a4..998fddf270 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -566,8 +566,11 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, ff_id3v2_read_dict(s->pb, &s->internal->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); if (s->iformat->read_header) - if ((ret = s->iformat->read_header(s)) < 0) + if ((ret = s->iformat->read_header(s)) < 0) { + if (s->iformat->flags_internal & FF_FMT_INIT_CLEANUP) + goto close; goto fail; + } if (!s->metadata) { s->metadata = s->internal->id3v2_meta; From patchwork Tue Jun 15 23:31:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28318 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4310038iol; Tue, 15 Jun 2021 16:33:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVljOu/pj7wVIz4rCYsEezW821efEEmRIXtk6sem5GqWzzq+WoNBxRA0Bi9c8bZ0kuZRv/ X-Received: by 2002:a17:907:628a:: with SMTP id nd10mr2081440ejc.326.1623799995920; Tue, 15 Jun 2021 16:33: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 10si398037ejj.654.2021.06.15.16.33.15; Tue, 15 Jun 2021 16:33: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=RTSGLcmK; 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 3E5F66883C9; Wed, 16 Jun 2021 02:33:11 +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-db8eur05olkn2064.outbound.protection.outlook.com [40.92.89.64]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 81ED36881EB for ; Wed, 16 Jun 2021 02:33:04 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LHxIwbPsh8sSb47FQxXht3KKXq0IFg2f0/UaVR8++fgMqFn6XjL8ZdEwjyr5Rks4DyKmMeSTTcg3xNv6zW/jz7CXeUKE0OTgeCHHVz+w1R+G/sHyAuebEoOlOYl6ztzBYC2qOJG0Gn0L7ZwaybD/MZWnAyMtYInwsKqxiw0oTHyGxtqUtN3riqPFKpiDG7mzsfEVYq82a+DC6jxOHOfhJlYSBmbrNB5P8e/oCWnOy8rkZRdSKXAjoJggO3f/q9QvsKoK/2KpEPHsw4AMRmAJKSeAwBbu03IPpJmCq91qLBP8252Wh+AhpREYCxL/3h5tTAzu9NTaw/IscFRLCpNcVg== 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=f8HctTpLHxAy3ysyxs3B8v4fFmfKYgP8RHaYeKrGeIY=; b=LX6UOxjWpN+joW3UiQgz5NUEgtmkKTXwITfddhWm9L2r7CKMd8M6RY55iU2j5YlRUWWZWblgmAkNex/kwaqWBntVpw72l/lWiym/1agHR4SZoyvGONVOxkHJojXnhPY74o6pDRYNgIvkZN9GLjZ4zq9enFcvLTUlxYAHysmLgaNCTxjUzTFlXM6o4FQTlyLAEWdaQbF/9NgSTcTjL5SazRRcjvUfvEM7527bU0tmDqzc2yLyWywERE+xG7xvMwSNUKB+LX1ZQQa/utjJGHW/lJQZyB+BijFkkxWQWrwHYIhgPT02H60o5gOtGPm3624zixE+hfI4OzwJ6wmycTV8TA== 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=f8HctTpLHxAy3ysyxs3B8v4fFmfKYgP8RHaYeKrGeIY=; b=RTSGLcmKXwTUc+vYvZitBIJGR4cyA7DdRyt0pRBm8y6x1G3h2lgRbSSig8QTWuHgD934dlStSNtiepjR2iV33rs3LGNH5uMlRYPOknEAvcPLrt8eVmY2n5PQymlGzmbNjC82QKkBZYDShwDy9xSOCR4ldlRA4Jvb3T/0Si8FaxqTHTM9vGoRcLBRYopgNzpYFtBwoWkMFlSrCIedYE5r6TuzmSL4/yQ3SGIIHqtAznMg49gH9oeq9J7iBopIQuUlwATB6cRiejeODBFiibe4Q7a/GXIu4AK9Bs+DgmBZmb5lgEXMGsPnJbca5T91aMGblv4W78mY1WkDaEvsCfW+2g== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::41) by DB8EUR05HT113.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::463) 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:03 +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:03 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:02B8C52D51436AE5EF37738A4C1C94AC9B87978BD999D0A0CC1037C2AF134F91; UpperCasedChecksum:C1AF36956B57ED3882C02D57CFC7F543EF4D01CB58C3B98C06380D76659A3A1D; SizeAsReceived:7590; 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:03 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:31:52 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [mVdW+VBdJZISMwwtjCOJLB1oadPB9W2b] 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-2-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:02 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: e770be36-93d0-48b8-e969-08d93055eb3e X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk92w3tzm64AvbWP5CJtYQNbKsxgxpBTv44W4kbyxV/OBppUk9FDzgjrebL5XK5UDDxjqHdjyKldGVCJEfrAx8OZVukBLkH8uV1SnzhFAwcjhMUOM7c6aTOLkijfRgGmHprOzMvryCKKQQROn2R1dJKmVuH2Ya0OUyxb/UZD3bgnJIhPQb4+LXZoR/RKnelMfd4oI4c71Er+Z8Q15+LEy7rE4GirNHGiPwOvtEzqbTAC411xPk7xGg6fUG/arlujxQSERLBH84qJG1Jofr3bqXJnOj8oJiqFMzsZf/+84sdy8Ee6GYE1ZUJz+EccErZuVIu2Efi730TT4UCKODGF13ujU7F7RUknbok/bYhpOm60nC/eKcbS3Xi8r0hJUvm+ojp/qLdLnvtbiCpy2rtvxqmrjXOuoag4QwmzyFCplgKeMiMp7t/jRb82Oh06Ea79QCzRQ+e1Ki/9jboI/0jnPwHUJkKRwJbcVnbOaimelOU1NfBEAEnAQfqIF2Jm6dDvxIhV/KEde9pqCe1kHQnspU8I8YTehGUcY8BdryNonjwnrdy4wbhHxjpFo1wtL7oU5ZkY1H3SynqEMmAt1esUdR0u3RzwAsvqiDzvkT8RfrurJmbzjpZnDk9oyCTZrkvHXRSanL0zFLVthH4F1iYQme+GB2WJVPwMTt96C9dvQQ/8iFm7Y4NFLNdnBLi8AiJu3X1SxkLzkHZY6lRhPT1XFHR/LqrO3S7OxJQ= X-MS-TrafficTypeDiagnostic: DB8EUR05HT113: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q3+sP+oq83BZw+rjiwKykKaOhKlJdowj2p13/zlW3gr+2/NbDz+JAC7KjGieVhHdlstnMi6OwX42dj1aG5jWmp4ENOnGd9WWxC8W8v+PGx70tP3oGkOmV9zXyILJzr603iQHahkiYt9b48OSY4j+yGtwypdvH+LiAE7c+IsUiLTrdcanNcB8U5hPH7ZR8I+hBToldNwxul876O+cbEu5sCJJIDwevTwuTM1MizvVvw2OONVBcszrdkjZHjH3fZbt0GEbxuQFtjjLiiVfkP0Us5jyoDRp7BzsuYOKDCJncqqCZOHwte/hnqZrPV1LW80uGslz1R+95qwO5JYdJHMkREp77mzFQA8yrvaQ3ANycG4OlVoSSCE34ISvV9o1Vdr1AmHY712GFt0c1PWmsvQxPw== X-MS-Exchange-AntiSpam-MessageData: R4DaF1lE9YEg3VqJv1Sv/OhEiKKCpy8otwyraFiXIeeslNK5GLBFtxvce/QHmBr/j4jK+MRdbNcqR/DYZc2tiwC88yq4Uh+3QrJJcpIqF3OlOmSQlcNHTRoBtMbiYvtR9L8lZdpchtWWRN3M77/Ydg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e770be36-93d0-48b8-e969-08d93055eb3e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:02.9546 (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: DB8EUR05HT113 Subject: [FFmpeg-devel] [PATCH 03/54] avformat/4xm: 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: xRittAx3KAmt by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/4xm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 427eaaddd0..f918b1fc57 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -283,7 +283,6 @@ static int fourxm_read_header(AVFormatContext *s) return 0; fail: - av_freep(&fourxm->tracks); av_free(header); return ret; } @@ -397,6 +396,7 @@ const AVInputFormat ff_fourxm_demuxer = { .name = "4xm", .long_name = NULL_IF_CONFIG_SMALL("4X Technologies"), .priv_data_size = sizeof(FourxmDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = fourxm_probe, .read_header = fourxm_read_header, .read_packet = fourxm_read_packet, From patchwork Tue Jun 15 23:31:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28319 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4310150iol; Tue, 15 Jun 2021 16:33:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzK5qId5Hbyt0Zbg5UUJyM2qM4b6VLovjuD292HjUZQEdnoQGVmzsKW4YWwqUtTEt/Tt8yA X-Received: by 2002:a17:907:2642:: with SMTP id ar2mr359892ejc.391.1623800006649; Tue, 15 Jun 2021 16:33:26 -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 f10si244340edf.268.2021.06.15.16.33.26; Tue, 15 Jun 2021 16:33:26 -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=nNaUgYfV; 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 B8BE268973D; Wed, 16 Jun 2021 02:33:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2063.outbound.protection.outlook.com [40.92.90.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7F70F68834B for ; Wed, 16 Jun 2021 02:33:09 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c4OnAX+/DuT+a9i/7YPqcYyLPoeqWw9SceoISD/ZPQ7vplsfTMvxkkVS1CbKIA94IdW7yoBS6mvx8SlBbPs3sLL32IzcEw2M7gIzya+JA0xcOkE0r31TGXpI6b1c/VTbJ4hepfkYWiHWPjA0OpSIUONjXKTIqCaRDf0lIkP4po1QeK9Cn6UXq8qI3sxLTY7bsnhrF/0ENbaIGVbusgGJgSR3AnFlany1FkpYnoWoUl4juz5op+JftnUvQhsSiMpg8xB9af5d1hWdSz5tnOUKZNaZubVS+ZF3ZqTPM/3tWF7+/HKWpdm0/qdJ4Mi+KEXJyDRh1VvYt3AHX0d1qmLetw== 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=M6ezkpaXycK4yvA1NGz3cHmm8DAwTgw1dJuxdDowWZY=; b=ZjHyTXFLSOtClqksjFNXvyUU1jMGQ4TCv0+QuGHxuWfOgtQoDJJfYhpdOHd04LIqZrB0OFpN4BCcOcGioF6IuLGIz1Lm4gXK69WfuaC0uWc6diOjTeiFBhYqyq34FheZr9nLvSqrlDUDBGbtQJMhHkazAYwtnrPgQZ0UdWYZOLANi38IOV+WrYOqAxvtXXGVgQNXEb6uCFdLWJ1xDNwtY0FJhHI5y2SGKSKr+jrTWQi07grqb4FSKEPar5RQD4kAkzD6/t6cMh1s/+aO70gxRaRvX8vE6h+oE31HXwmCxbwujKTlToDg2wlsMqLz+iQjdfWW3gxcZvYtOE2c73FvZg== 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=M6ezkpaXycK4yvA1NGz3cHmm8DAwTgw1dJuxdDowWZY=; b=nNaUgYfVN0kwhf9gYlCJO1ZT5qQCFvcfPZDTnH2cyduSnmjYOrpwbXvfGUaiqdNI54/dOu7Qwb895PwyeFwPtzW6zbn2GKPnz1WDwUTld83H3zlTZLIbFp5+xgSe/bKwi17nc8jzqQAiVXO1AGQxgpgBDVuq8BAwDEz0qlbxnO+ZkzYldWkq1yPK4ln9SBRTItSQxYsflSWKCkQXrPECvl+B+3StB1iuLl6KvD0BTqS9smZPZm8vn6XqK3oaC9oAkBXKtBJ6A1y+cXaCtUakrhZm/9XB+FOhWJOW7g/7hOuxYbNE8Ij6xDILGfhv09oZal7/JvxwrHRHgrfJDoznOw== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::51) by DB8EUR05HT048.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::140) 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:08 +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:08 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:1FA174F3DE6E20451D6FCFD5A73D418F1A0A2A68F3439A7BD9534E9B2ADB890E; UpperCasedChecksum:392D4778B675436BA8D192AB0655C2E995A6E76E0E16E65F9D33586E4DE0527F; SizeAsReceived:7591; 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:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:31:53 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [EsPx85Eu+AKsiy9siyWI/8g5F4GfnsTH] 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-3-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:07 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 6b915a39-25bd-4e34-cf89-08d93055ee6f X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk92w3tzm64AvQFiLaB+QkiU+GLTn8sOIdTGEEtTi39couGgNrKLkwZH4Om5GEhWqkaY0961ddGLJAAw/HHZBhf/zHuumruAwRmpndBFfSGTBaT37C56G6w3X11r6buHKmXgMFARM3ACDwotEAe+Aj5k52DtBidEopT+Plwwc2kMsIBQmV/RBx9KoxZbaUkEQEQOleHvbHW6Gxye7C/WPvPrGUDHiLvgLNJCOyTpT5Q5fv8+Nsdu9uLpIPmtd9pCkmWx/NjCRqkGeJr/wbJY/3RRqiqoF8oOUtEsJ8D4pl7suIlQDk8m3ddDlauWp0FaaB6x7ZyW1p7FVx74Eb1eyEbU3Jh10aM+p5fEDLorPWZqRwTohkCS9gXiIgfo4Z8/3KZMoWICtG2Q+o/p4BCf+beWsgFIzv0poo4FboQqnkiKKGUqvMcJYmTH3/1IvBHPD2jJ7hxAzCc1bG5s72VEhtTYru6R0FAfCInsaQzPiqWRX04E1ymNpOemELYxhMww7AXvr/UafNGYxT/DAcY2QHKM2/DuxsoCSw7PY9IJf0yGa4ywjVneV3DoNKryInNi6daNfZJo9in9Ke2NqzJ3jJnz8EfTvm5QRew4pQXPtOrY72FuKAJUzFYFKrNZMwpl8nYB+ucLpTlBAJMmK325yEtR156oztNdQmD/KsLnRiATLMyDPQF24fVCDxKQsbrk/8gSETc51wTuIzwZFqGL9us8SFgZdQKzU+A= X-MS-TrafficTypeDiagnostic: DB8EUR05HT048: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jHovoUDxev/6/3wT+ldwuNYHsFOMbNoIYh/aGiOgLVBKCfNWTnVijy0oGgeR683WEbVD4qlerBoh4dyyIFIiJkY9FqMCitOVLGFr0533BJ6TeOU5Mkd1vay8YO70DuryCJ1ZZs928Mz8h6pqktWWcyjhrnPbhny+yZPCDY4xM+HkK4Jx/fZX2/LoZc3ESFbj9b0fDQ5v293ar/tMm8RoV4FzP8IGdE6vdY89JPz0Ws6JIrT9vIImyCjpPZhZFeVA9IKJp7RXfclp+HMjlGtcx4R7Zi0L8HbK0dgrXdxV+l24cLxUOFyMq6gZdyXxKXLKUUXSoSNs0g7WZUtX2xdOuK9ue4fEoOiKySvUd0aX+JDOSVZQcFKINr/TYEEMKNZE X-MS-Exchange-AntiSpam-MessageData: kwmRMPgncZi5UESvQyS6FP1L6tYfJKzSpjRuzHggp/EI26BXJbkqfFFbLVsEG8ENppSFV+Sptvq4YdtigAVZJu9JtN0k1aUmUp97T9solFIyh8KX+xhO1rjvyIcPPPvG7Yupm2qxjpVjSuXtxDC/8A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b915a39-25bd-4e34-cf89-08d93055ee6f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:08.2723 (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: DB8EUR05HT048 Subject: [FFmpeg-devel] [PATCH 04/54] avformat/aadec: 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: bOtLItCcopVR by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/aadec.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavformat/aadec.c b/libavformat/aadec.c index 70df0439bd..247c498147 100644 --- a/libavformat/aadec.c +++ b/libavformat/aadec.c @@ -175,10 +175,8 @@ static int aa_read_header(AVFormatContext *s) /* decoder setup */ st = avformat_new_stream(s, NULL); - if (!st) { - av_freep(&c->tea_ctx); + if (!st) return AVERROR(ENOMEM); - } st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; if (!strcmp(codec_name, "mp332")) { st->codecpar->codec_id = AV_CODEC_ID_MP3; @@ -230,10 +228,8 @@ static int aa_read_header(AVFormatContext *s) avio_skip(pb, 4 + chapter_size); if (!avpriv_new_chapter(s, chapter_idx, st->time_base, chapter_pos * TIMEPREC, - (chapter_pos + chapter_size) * TIMEPREC, NULL)) { - av_freep(&c->tea_ctx); + (chapter_pos + chapter_size) * TIMEPREC, NULL)) return AVERROR(ENOMEM); - } } st->duration = (largest_size - CHAPTER_HEADER_SIZE * s->nb_chapters) * TIMEPREC; @@ -418,4 +414,5 @@ const AVInputFormat ff_aa_demuxer = { .read_seek = aa_read_seek, .read_close = aa_read_close, .flags = AVFMT_NO_BYTE_SEEK | AVFMT_NOGENSEARCH, + .flags_internal = FF_FMT_INIT_CLEANUP, }; From patchwork Tue Jun 15 23:31:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28352 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4319520iol; Tue, 15 Jun 2021 16:48:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypHbFdOIauBSpyN+C9xBzJPQJMRx7uC6Y4eejiv39hN9xo97UBOeUsQ2A/udMwgpA9YQhk X-Received: by 2002:a17:907:2be5:: with SMTP id gv37mr2154753ejc.237.1623800926171; Tue, 15 Jun 2021 16:48:46 -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 p1si312593edw.127.2021.06.15.16.48.45; Tue, 15 Jun 2021 16:48:46 -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=eqQpqpEn; 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 86C57689BBA; Wed, 16 Jun 2021 02:48:42 +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-db8eur05olkn2091.outbound.protection.outlook.com [40.92.89.91]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 61817688081 for ; Wed, 16 Jun 2021 02:48:36 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H/jxka09NkZpFYs9dMhkFq0Va8LS6sBO6bBZI3mUuDJ3eO2pRaongV/7TUReem/NQUnfyTuJOohMFcEKWUl95xeWFsRA+jGSRq33WkvbJ6llmiC7Tj7B24eOJux12Y+xD5xGFvbi8G+jzZHAflS+JdCge9uPIRQct2NXneq5C5/myI57CbmGP4VqX+YKsuDerXfDevRK5c5A3MRWntkbaHMiKoZZ2ah27nvm5pVRX0AyuzrHd4FxvyJ8wuFHW0V+v+2QUK0TauNinS8ftk1T7jahZg6sqz5SCX08SExGaQB+wjIi26I6uZ/WMIDgSBRlZ8Blf3wsFYd05XpXYx+Oag== 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=19bvCBJ/KZ5aY1D9uu5p27YI1kC7cS/eXe8kyDLZ23I=; b=SU49Wj9cKSRZxipX614MXeH+UQyq9kzV6DJH8a1YUTCZJPG0yJP6G4aMnUrtLKThaLc1Vp7/BcDzB4namtJ62TjW/wAnVC1oB5QvYtj8FEqaUXxtDA6i7rGwzTNPj6DKtMUeUnM+Ul3qoX8N6xppVmTnYhQmyPUuWpgqVxylnk3hYN85hFYDDSqsnoujAZf7zOz65++QyJNb7LykEMuQTzp1fd5AIijNwz3cWzB1NcOytVsjgG1s+Cno4xY/UrblT0OUytKkEuYUaKjFLI1JkVWluGljwgNXnXRtQxafbdtHl4hrbAJWYCMbylnk4hVKP/O734blYiJp/ZXjp9exjQ== 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=19bvCBJ/KZ5aY1D9uu5p27YI1kC7cS/eXe8kyDLZ23I=; b=eqQpqpEnTQ8r3d37gHg93JMCgyR8zPFeD1AnbNpeGMCHaOSFub3cUR+YbzBfFn8iOK4KYeyz58Fogow4BDsSaEu7Xg3KQC1DDwer/1kngg+rbjvhQupMninZfCVAdw6+axU1Ra4u0Gs6/dbpXB67tO0jDI2UmTeMPOTPrIitJRMbaG+pJiVjARC+RvcGt1aIpacjaqd9uEd7PnLLdlhy7PCKljEH3tMyXBQm+SgVt4c5mlf6abGNKOWWyypREtw9nhZn4GFKmMSJ5I4OTsCUOxTPa8s6LkHQQW8iRZxe5X6iv3lDGcmXuPA8Ge2WfxZgKRgqwM3TvNs+3ivMq2WmNQ== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::41) by DB8EUR05HT015.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::457) 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:09 +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:09 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:622FCA2CEA5DDC631B05538E78759147DD3FA699B6B6A941965555E4DDAECD62; UpperCasedChecksum:3A4E70CC13164BE21D807DDEB550971844BBE79B0D7B2CB19C301359BEB4CABF; 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:09 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:31:54 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [apa56ULCUCRo1YVIBay4fn7BAlV2bXXW] 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-4-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:09 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: dce1ba1d-a013-45e0-eadf-08d93055ef37 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pWhkGqqrkWQJ/G2nBDhW1VuCUfUvgQwiH7rget1HUOjFrEum45Hm8dZ0aFhI7p6piV1lpH/NDEBzZyBRWyj/SwEkkD35CaBdMvE5GW1ybcLlPXzZsynvtmRTGJz+GrUXN3Jq1CH1DtQ81rK9Y8N9y+Bd/5QyuD0esyQq0/V45HdsNcXrBYr/1V027uBLbnaYauiqdB2xxBUCiN/4fMgnH+h/2uiguBzVvKSrnYdRo24LFuGEDDeL/bIgUjdyHQuL/w/2L7791CY4iZ07I27k7OZfQuYZiz82CYlgfZwk/SgqYKE/sZ9zmNLQ2sdOO+5R7FLsJLgeiS/bYtbK1gE6U361d/GE2HCvKovbVN7NV5Y2RNbQmasFb0HsvZD/DI0hSeyhjvHtU5sJiAJKaHE8Jc3EyekzF60YpLgy32kxM7Pkbq3SRCWjGrTTEqvDqTcy23s0f8X6I9cjTPAyyBybI+yuei4B6gRDt5sxFbMCl4A5YRqEsp5AdlQgFQUQDA4Y8aqPXmPPDtm528AkYvfEain7Z8hbn30ZyeY9gPga8tPx5AbwXHtFjsOC1UlNiTICB3Qwwd5scm3hZltaNTt0xDRCAYjxQJFWwGkkpOfsnTpyFY4IUVm0UHkPeO48zi9UL6McnhyvSx4MBBGpZnbpacfJI7xvmxHJcyic3ebRi4486ZmRWHViae9HOGIKL4Ijeh2sp1UKX5ZkxFRd0qWSOTIogxyCrLQj0jmBKDaoXugI= X-MS-TrafficTypeDiagnostic: DB8EUR05HT015: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 21hVsKacdYe+YP0jj4AmeeQRgvRP/hPh0BJgtARpYFPDQ2yIxPxpzeEHlO/KO2T4d0OF1WkRhZwldGsoqcZHrPP9T3R4dWivNGKr5qd9ZgPUsVpmCCOXxand9i5WgYQg1o6wbb/9Cigrt8QLZJDpHsh8vToEAFQWx0movO12kw1u1orWtaRlR3DAlIfmdfGOfNn3kzEGvapUZxSeSgckm61jzWxB6qNxL81AQrSD4zaDyK8TKlaUd9B/RkFM9vMZ4tXNzLYV5eVGZEGzI0MMQKqCxBi61iNr/blhzorxEz0Pix1RKBgM+WkbC3Sf1x9LfQXrQKno/X2xQmPHypVPP4aWcD7bsfh0cB3RQdqcAdIwwJqsn17GYdtmkrHPPxXIHsJ3Zgn6bKkr/PirI7kTdw== X-MS-Exchange-AntiSpam-MessageData: NedEpCnMpsDPWv3XuGGUdik2UT4Rwpg1MKli5OlymYDgGMoBHNc/i6cC94nHrGJzv9V0Suxo17QITcujqWgrM9O/4UuQ7aU2xvf6AM2qkgV+LdSb5Ire+jSEAJK83fI1wV7NX8kyqoAs+psYBkmE3w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dce1ba1d-a013-45e0-eadf-08d93055ef37 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:09.5847 (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: DB8EUR05HT015 Subject: [FFmpeg-devel] [PATCH 05/54] avformat/aaxdec: 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: gfftkoSlRZDk by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/aaxdec.c | 83 ++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 56 deletions(-) diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c index 0cbf933dfd..38d57d36c2 100644 --- a/libavformat/aaxdec.c +++ b/libavformat/aaxdec.c @@ -150,26 +150,20 @@ static int aax_read_header(AVFormatContext *s) return AVERROR(ENOMEM); a->xcolumns = av_calloc(a->columns, sizeof(*a->xcolumns)); - if (!a->xcolumns) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!a->xcolumns) + return AVERROR(ENOMEM); a->string_table = av_calloc(a->strings_size + 1, sizeof(*a->string_table)); - if (!a->string_table) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!a->string_table) + return AVERROR(ENOMEM); for (int c = 0; c < a->columns; c++) { uint8_t info = avio_r8(pb); uint32_t offset = avio_rb32(pb); int value_size; - if (offset >= a->strings_size) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (offset >= a->strings_size) + return AVERROR_INVALIDDATA; a->xcolumns[c].flag = info >> 4; a->xcolumns[c].type = info & 0x0F; @@ -196,8 +190,7 @@ static int aax_read_header(AVFormatContext *s) value_size = 0x10; break; default: - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } a->xcolumns[c].size = value_size; @@ -222,9 +215,8 @@ static int aax_read_header(AVFormatContext *s) ret = avio_read(pb, a->string_table, a->strings_size); if (ret != a->strings_size) { if (ret < 0) - goto fail; - ret = AVERROR(EIO); - goto fail; + return ret; + return AVERROR(EIO); } for (int c = 0; c < a->columns; c++) { @@ -244,10 +236,8 @@ static int aax_read_header(AVFormatContext *s) data_offset = a->schema_offset + col_offset; } else if (flag & COLUMN_FLAG_ROW) { data_offset = a->rows_offset + r * a->row_width + col_offset; - } else { - ret = AVERROR_INVALIDDATA; - goto fail; - } + } else + return AVERROR_INVALIDDATA; avio_seek(pb, data_offset, SEEK_SET); if (type == COLUMN_TYPE_VLDATA) { @@ -257,23 +247,17 @@ static int aax_read_header(AVFormatContext *s) size = avio_rb32(pb); a->segments[r].start = start + a->data_offset; a->segments[r].end = a->segments[r].start + size; - } else { - ret = AVERROR_INVALIDDATA; - goto fail; - } + } else + return AVERROR_INVALIDDATA; } } - if (!a->segments[0].end) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (!a->segments[0].end) + return AVERROR_INVALIDDATA; st = avformat_new_stream(s, NULL); - if (!st) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!st) + return AVERROR(ENOMEM); st->start_time = 0; par = s->streams[0]->codecpar; par->codec_type = AVMEDIA_TYPE_AUDIO; @@ -282,42 +266,28 @@ static int aax_read_header(AVFormatContext *s) if (!strcmp(codec, "AAX")) { par->codec_id = AV_CODEC_ID_ADPCM_ADX; avio_seek(pb, a->segments[0].start, SEEK_SET); - if (avio_rb16(pb) != 0x8000) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (avio_rb16(pb) != 0x8000) + return AVERROR_INVALIDDATA; extradata_size = avio_rb16(pb) + 4; - if (extradata_size < 12) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (extradata_size < 12) + return AVERROR_INVALIDDATA; avio_seek(pb, -4, SEEK_CUR); ret = ff_get_extradata(s, par, pb, extradata_size); - if (ret < 0) { - goto fail; - } + if (ret < 0) + return ret; par->channels = AV_RB8 (par->extradata + 7); par->sample_rate = AV_RB32(par->extradata + 8); - if (!par->channels || !par->sample_rate) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (!par->channels || !par->sample_rate) + return AVERROR_INVALIDDATA; avpriv_set_pts_info(st, 64, 32, par->sample_rate); /*} else if (!strcmp(codec, "HCA") ){ par->codec_id = AV_CODEC_ID_HCA;*/ } else { - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } return 0; -fail: - av_freep(&a->string_table); - av_freep(&a->xcolumns); - av_freep(&a->segments); - - return ret; } static int aax_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -406,6 +376,7 @@ const AVInputFormat ff_aax_demuxer = { .name = "aax", .long_name = NULL_IF_CONFIG_SMALL("CRI AAX"), .priv_data_size = sizeof(AAXContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = aax_probe, .read_header = aax_read_header, .read_packet = aax_read_packet, From patchwork Tue Jun 15 23:31:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28389 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp122598ybk; Tue, 15 Jun 2021 16:33:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZBTr/RJPXOZxvKP4i8uKbdYcAhqaqGzg22f+Iecq6ILoZgD73gtR9utxuzVjRy4bbRkzm X-Received: by 2002:a05:6402:2791:: with SMTP id b17mr677245ede.113.1623800018574; Tue, 15 Jun 2021 16:33:38 -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 y3si402130ejk.208.2021.06.15.16.33.38; Tue, 15 Jun 2021 16:33:38 -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=bvrbSsxa; 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 0F7006898E0; Wed, 16 Jun 2021 02:33:19 +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-am6eur05olkn2101.outbound.protection.outlook.com [40.92.91.101]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 253206897DE for ; Wed, 16 Jun 2021 02:33:12 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eRTFMKwISW0PKIOBabMDayNTOKWUWewl+8znBAKdfY7LqQXKEC+9sxS40ihSmsB8DsRYnmewF1DHn5PoaEdorhYYH6DX/tBvGwKwMvIxI/VhzT+j7rz7TglmUGFVjRg42kycdsteqS+8tNZh/ycZCWFiaQC7RbVoHYaGH/be2aU/vU+h7lBJMClKSW7hxbwlg3NdRF4ay1Nkzhm4uIPSn0b18LMLqV5pqmiwRiNgaxlZrkCMGPCIDoaY5zhWnAz5dMGHcclnax7tuaxbddntTV1BgVHnGWAGYcKQ2+/70K7CNsiHm/GG5Ovl3QgAyddq3A578uUqbiizJA2zvmYp4A== 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=5j02LgA/VlpsCCq0Dutwlwy33vzMhEMdkjmLtuDgCE0=; b=QqlyZ4hbzG/P4CPS52zMVUBhgX7w9UVO/HiMVp4hU711QKWQ1v5yoVRhn+tAvcQL+qYJOhTP0PmxhTqaZvhu9caT1V2R7nvdmA1iilbIhzGdNbreLI5I8CRs5jdNrr04ggbgUah5nxENst73BJzQaA5sSwfjZU0owyMGIfxxtT+qE2+gOf0Eau4MG5nXWEzGeJPGEj13GKy3wo8VMRuYlLgPKb35WXMywXkd3frxVqmubkR+jv8jmzZR8pVqXqNNDLiPjYuLMeC98RvKrgXCtCZWp6NxSbffUJXO8a//rAQ1o3iTsCGkGwM7qJ7UmKe8ozTOX2JegOPfE/9HbYCNVg== 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=5j02LgA/VlpsCCq0Dutwlwy33vzMhEMdkjmLtuDgCE0=; b=bvrbSsxavJ4fdswA5rC43iVG5e4wt1ltlGjJ1nVS53zMoyniHp28zYDT+4wCZIR1+TXdHDqgcgA23EQOGksRKm4ZAsSR/SUtuZe4VOU1VQu9H32X6h6SAbge4iGxPNXDsQDHgA6AZZjNFJdAG365yfzUdTJ5jxRrMx5OKMkQ1/6Ir4ShMiwsix/uSVqYuT7JSxfUZFJ6LXU0EsCsyDYTZQvuEXq1E+QtlLIOJ7fp67pLxZl6SucDYPdpV50Wb0f8CMnt2voqpnwYzJHYgcinBB/RbCPxjXKsRw2kNX6nxgW6IoYq9F1glwcyFpvRCtQQAQu6h30AxGWf788BUhdJ/g== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::48) by DB8EUR05HT012.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::139) 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:10 +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:10 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:70C524A5504F589EBBDB81ED7EC227D93EE9EFCFDFA1ABFB3A43D9A089C33B3C; UpperCasedChecksum:EDD2B296FB149AF586DA30062754CC3785101E79DFB6AE506EF7E97C5A8FDB59; 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:10 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:31:55 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [1QxMD1xgoLl+CqY+r8aCk1DGN/JS2x/S] 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-5-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:10 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: fea7f0c2-0877-4492-ce21-08d93055eff5 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pWhkGqqrkWQJ/G2nBDhW1VurDrDJ+qTT2Jqg+yYcW+wWKVoY5SnvajdNCjnRDjjMhAF/UoLxGAkwnRcAWBkvALyzRqQlebh6ezI/K5G+unKRXRLg2rJTmEoahhA0U7X43DjNVdJy+5RmUEYvP+4ZwWyj3UW4E4DWsNMJ5nEvFJnVR7nxrgiczZt4NhSz9vfxFKpmI8plLbXgEAELvNw9VS6rUswBFSemj+0+vkpdafj0bgXukSJpVUoe8LaZtzwkJePk8iIr16N2ac8xV8xjvCeXPrg1bEBFriOs59Kbtx8X4n6nGILxZq5wbXFJdxF9zL+fs74D1lidtRXVdZwJNIDH/EqDz04ypgcITe3IROPY5//NRNIXf8cCq9Xcpy8D9p9Le8Ubaz9T7CtJiXGMcYdBkpXcgQ6H9wv16+wVNi9N6a/JiF69th0HVZcgNHQI5MIR5UapYN6kSbDj3BpEW63H1oOWXJcNhoSH2PFsXALDDY7G79/J5xvlsUSjGVjfby+VYfY74TjN/LgbJdgGtGoUpQxcr2hSgzfbvAxmzeKc9F7bo0J45rW1dJxBJJoPrc1r65wSb79/yRZ6+SCYTS+zczf2RGkRy3Lj41iKxKvoYsRfU3UO2p+ndIZyNgKe2d5iaU9mFM3j/okqnKvx78a2/SvO3frbMWDktRL0ZS0H7Wy5jqEb/eyvWRuVdfwPYGacIdN34y9ExaQzEcp00QAP5yJgTNASVr92l9p2OTdo= X-MS-TrafficTypeDiagnostic: DB8EUR05HT012: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nIid9LN1NH3fOdxMmM8N1XAOlLEyQAkEgd1YiTDi5InZhiD7lDv4LO6WpQfPx1qh5OJG2pppTy5MAg652LTDvANxW3ZITuvkqS1AX4HzUd7t6zwc0cTz8yp9qRHTy5tzSANeu74zKpXXO+JToXGjr0ZY0uokfWp5NVsrz+RAcPGk/QOgFJDRRZUhq2yy3OEGJ+wuS2vln5pL5XsX+vr14aYPOctqvxKveKE6WrqCDPCGYm/SvFrWrBBtXZUk5HwixF+02B8SuytSVopsWfvBbaJsHNN9QvyGq9p0U67SF29UWJ6wOMcjkQx2s+Wcum+1TAX+o+MPrQcLYmqFCS0NZiwhcFEeF1jDtcm5iWHqv7nW2/O0ybGtmkfuRJS4BtgbUxNRISScCINc+3Cu25A/dA== X-MS-Exchange-AntiSpam-MessageData: JIdj6Fpq0317kB8rCCtpxtcJGy/KZ4Y0ioWZ22HmT2LDkNGmEaUKI4HAIaWmS4Cb60BPWBop8PmvV5mAG/VyKZdXcwa0tFJZ/d1kP1J4uii7O06gJTRvUajWbByP2wSFWqX3ArbV2V94O5sq/guDRA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fea7f0c2-0877-4492-ce21-08d93055eff5 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:10.8221 (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: DB8EUR05HT012 Subject: [FFmpeg-devel] [PATCH 06/54] avformat/avidec: 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: HqpZ5kJ7wf/J Content-Length: 5861 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/avidec.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 14a2dd6cd7..39039f5bc9 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -122,7 +122,6 @@ static const AVMetadataConv avi_metadata_conv[] = { { 0 }, }; -static int avi_read_close(AVFormatContext *s); static int avi_load_index(AVFormatContext *s); static int guess_ni_flag(AVFormatContext *s); @@ -474,7 +473,6 @@ static int calculate_bitrate(AVFormatContext *s) return 1; } -#define RETURN_ERROR(code) do { ret = (code); goto fail; } while (0) static int avi_read_header(AVFormatContext *s) { AVIContext *avi = s->priv_data; @@ -510,7 +508,7 @@ static int avi_read_header(AVFormatContext *s) frame_period = 0; for (;;) { if (avio_feof(pb)) - RETURN_ERROR(AVERROR_INVALIDDATA); + return AVERROR_INVALIDDATA; tag = avio_rl32(pb); size = avio_rl32(pb); @@ -582,12 +580,12 @@ static int avi_read_header(AVFormatContext *s) stream_index++; st = avformat_new_stream(s, NULL); if (!st) - RETURN_ERROR(AVERROR(ENOMEM)); + return AVERROR(ENOMEM); st->id = stream_index; ast = av_mallocz(sizeof(AVIStream)); if (!ast) - RETURN_ERROR(AVERROR(ENOMEM)); + return AVERROR(ENOMEM); st->priv_data = ast; } if (amv_file_format) @@ -603,7 +601,7 @@ static int avi_read_header(AVFormatContext *s) /* After some consideration -- I don't think we * have to support anything but DV in type1 AVIs. */ if (s->nb_streams != 1) - RETURN_ERROR(AVERROR_INVALIDDATA); + return AVERROR_INVALIDDATA; if (handler != MKTAG('d', 'v', 's', 'd') && handler != MKTAG('d', 'v', 'h', 'd') && @@ -708,7 +706,7 @@ static int avi_read_header(AVFormatContext *s) "Invalid sample_size %d at stream %d\n", ast->sample_size, stream_index); - RETURN_ERROR(AVERROR_INVALIDDATA); + return AVERROR_INVALIDDATA; } av_log(s, AV_LOG_WARNING, "Invalid sample_size %d at stream %d " @@ -944,7 +942,7 @@ static int avi_read_header(AVFormatContext *s) av_log(s, AV_LOG_WARNING, "New extradata in strd chunk, freeing previous one.\n"); } if ((ret = ff_get_extradata(s, st->codecpar, pb, size)) < 0) - goto fail; + return ret; } if (st->codecpar->extradata_size & 1) //FIXME check if the encoder really did this correctly @@ -962,7 +960,7 @@ static int avi_read_header(AVFormatContext *s) avi->use_odml && read_odml_index(s, 0) < 0 && (s->error_recognition & AV_EF_EXPLODE)) - RETURN_ERROR(AVERROR_INVALIDDATA); + return AVERROR_INVALIDDATA; avio_seek(pb, pos + size, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): @@ -1005,7 +1003,7 @@ static int avi_read_header(AVFormatContext *s) if (s->nb_streams) { ret = avi_read_tag(s, s->streams[s->nb_streams - 1], tag, size); if (ret < 0) - goto fail; + return ret; break; } default: @@ -1016,7 +1014,7 @@ static int avi_read_header(AVFormatContext *s) "I will ignore it and try to continue anyway.\n", av_fourcc2str(tag), size); if (s->error_recognition & AV_EF_EXPLODE) - RETURN_ERROR(AVERROR_INVALIDDATA); + return AVERROR_INVALIDDATA; avi->movi_list = avio_tell(pb) - 4; avi->movi_end = avi->fsize; goto end_of_header; @@ -1032,9 +1030,8 @@ static int avi_read_header(AVFormatContext *s) end_of_header: /* check stream number */ - if (stream_index != s->nb_streams - 1) { - RETURN_ERROR(AVERROR_INVALIDDATA); - } + if (stream_index != s->nb_streams - 1) + return AVERROR_INVALIDDATA; if (!avi->index_loaded && (pb->seekable & AVIO_SEEKABLE_NORMAL)) avi_load_index(s); @@ -1042,7 +1039,7 @@ end_of_header: avi->index_loaded |= 1; if ((ret = guess_ni_flag(s)) < 0) - goto fail; + return ret; avi->non_interleaved |= ret | (s->flags & AVFMT_FLAG_SORT_DTS); @@ -1079,9 +1076,6 @@ end_of_header: ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); return 0; -fail: - avi_read_close(s); - return ret; } static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt) @@ -1971,6 +1965,7 @@ const AVInputFormat ff_avi_demuxer = { .name = "avi", .long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"), .priv_data_size = sizeof(AVIContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .extensions = "avi", .read_probe = avi_probe, .read_header = avi_read_header, From patchwork Tue Jun 15 23:31:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28323 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4310689iol; Tue, 15 Jun 2021 16:34:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyf+kY4tXPVWFyVzwQuefr4tR34yO4xVUBB+xDHZoGNbqGUDVhGZBggR8z4hshJwrqjlcSt X-Received: by 2002:aa7:c7cd:: with SMTP id o13mr670231eds.269.1623800048496; Tue, 15 Jun 2021 16:34:08 -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 ar13si380671ejc.73.2021.06.15.16.34.07; Tue, 15 Jun 2021 16:34:08 -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=XIyt0En4; 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 0C0D2689888; Wed, 16 Jun 2021 02:33:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2019.outbound.protection.outlook.com [40.92.90.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 65C61689248 for ; Wed, 16 Jun 2021 02:33:13 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=esmKDAtIo+EWC5i7ScRJ7sUhuZvs2iER6OTmEuGNEFA7FQmn6tXKUlg8K/9xmX9vDCeJGdd4TglNLL5VDn9PAIQC5MkgnxLnft9y+8/tRKjdSp/RcWzTMnHrbF0qrN/O6a2GUOfA/FFxKatVtfVSKhad9Bbv+HqrQdmVtTuCsaVpO+rs2vccyL6fEDOQZ5EIMjMR+yxw1RMnzvtkn+6voSFdRSbXHfTyDTecGJ3WDHL3ClCcs6y4Zquv9c2QfADgtQ1hFHJSFdN5tVCowYhbIFOU2/fGD7hOT5Uc8aKTSLs4ftXWkxv0O7I5oQ++C8h9sIynW4yLM44HdPWQRag0dg== 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=ENOImnr3Ey9FVMJ72uT+/nnTfOTMZXETX758IZS5bCg=; b=FNKMoUQ5WAHrn5DmzcziB1kRyJN6+tv0WSzDFXmwdlgUEPKKZ9ZrK34+qoUlbYKXPy8BU/MHywH2qT6cw8PFCJo1Yi3o0K86SkMPUDvD3NY7+ukTo9nouXPG/YX24eTWQRhlv29j+GOph67+pi6mAEbzL/3olGm2z7zfauuYP3Jc7maOIlN770toEnS9+Oh6i1FSvLVuUcyRRDDpf3Kkl4CRbf8VHRNYyODqo79S3yw+AuUsBa6lKDei2hia0qYBhYQrMefhB7NC/4GsXPToCshKh6uFyPzXG/2LMN/35dwEP0T1Hqt3a7eeCqUeqXNMPi41rsqWryJBUTmGhJO30g== 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=ENOImnr3Ey9FVMJ72uT+/nnTfOTMZXETX758IZS5bCg=; b=XIyt0En4f9Pd+ld+djnO+64OeMAQUJm7LQ5c7HLtfpFy69zNdX1jgaKIreEGWHLlbSxH0iqby4/HgLblDSKaAKH0yiEsWGhQbTRh0qn8jOEHUGa5JoWynOpOsTId8+ZubKfGd8wn3sjrRLnnJyiUj6OEPCaiiMkr7jG6652IQ4GHxzw6LK5NvjIuUJUWi2ElxRvwa9PNP4WuXGWn45YM9vSbPnQ2Ad4es0CeU7ngC+/yOD2LaXL2DxcK2hhN++PPhxIS0ZSsFVkVznEzl5QYF1R+RVZqBZJFeUZ2+KRsZw24bw3RySrtWkROwTURzmApdPhnnkONGbdZo0U4MA+miA== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::49) by DB8EUR05HT063.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::231) 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:12 +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:12 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:C91C717076A10B9CDD05CEC790BDA6B20C8C0B5024FEAB8A1C956016A0AD4664; UpperCasedChecksum:7745481267492876CA8F73AC294A71D5CF0729DB016EBB0C2DB49BC5CD9BE694; SizeAsReceived:7589; 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:12 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:31:56 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [C4sr+w3CqKC0ezZB9xWC72JCfAjF0yyN] 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-6-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:11 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 11c2ff45-69ab-4c0e-0395-08d93055f0bb X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pWhkGqqrkWQJ/G2nBDhW1Vvb3M3LhdsBzRfYjYlF3GrdIxZr0pY0n/LUfzVvhRkdHR5MO9MKsQDl2L0vhuHEwDXBlFNgxdc7sXgtHCLwuEoJq0/kOUMjMU5ql0zkanb5N9dPZa5B/E1PwFnTcysUtAZZWkaTWtE00wbpW6BGJYOZIsbVzg/NuII4bJRfhvFuJlmssw00quPGZDW8OZOOQ80A2d23gEKWBQji9ZPrFnetB+MNuEOFggP1fjKW6APAq57IC3rfm6n2pX1ExmvOwLwj8ZnrNSbthKYoPhjAuhI67sLXLrGxNuc9goVzVz0D56iWGNJHBMC5yA/sDfRcNo4e/2fNNIiGhVw2jRgdqufoParWX46Mb01RutfuRU4XGn0DUAoAce4lSh9H/xdLnZsvd6dRVCH7sxLZVBKwkH5uPJF1WD2+wae8sn8FB1eMWxZH7izxlUr5Dx6K3CnqKwGhjaa7OmnqG6nbeh/Q7CZiFNrPBZ3EI23kfLXRTjPq7Qcn1bZmJVMKSK0kmcqASf/aiUM1fCNMLfpRdmgjL+WpN/hXvIuY+nxO3eXJRdpZ1BgetapkcGj38caOB2IjDcqmDWykjWmV9DrE6EmDspzzVcUh+I0B9xBAivZjMrqqNu3tJRoXuGnW0QMRwN6YCFtvUyZfwA0ozfHAtc1DL6CqMzw42HZHJ8+Rb0KvZyW6sUrAZrSeKXk/isUss1s9hDcY3FItK7N68BRTn7aHCmbw= X-MS-TrafficTypeDiagnostic: DB8EUR05HT063: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZnWINjYXpw5qTDpQDu7DBoPVo/PUwF+E1ePfR+ULk5pSV6IcUJ2wzUy8iUXUiXQ55+j2/z0KjqXOeVjRrtVUA4xYQXgKN9q2Ng38IVZ9agAJrb4QJs3ewKhlWzZJzxADJyhom0maGwEGEcs4cbRlYbK3e8QRF5lkT8p+0kZtPUAWyCVbCOJrhM0JsQM7jsrXkBckq2s9zTepJvd0NZ6+we33Hbpi1/Jei58J7cZdZC2PboLE7SfhJFjgiAkjgqeNFePM24ma3zPnA5hzSWILs7uopQNy8EzMGMYnU3pLc8OmK+YbBq9JEolTdgRb1Wxny6MitJfPrfXoawjf3NFcBBIoh55RvEItWlF7ZJLszCE6QutZF2WSKPSRAJq8gu53j0mExPKsJJBOPo7J7lzfLw== X-MS-Exchange-AntiSpam-MessageData: yzg300iE/BlA2JmR0kiERcRckP9yJ+HeFzAkOziI4FlviLHR0oZ/3EK89FjIzYqE9ew+/DsEtr269ZtE1mGEuXSISTFoZPm3b+jcM0dQw5wL727AaXnZYU+Ig1D3v+x3CUzGi0N4rb3LQVkubS7NAQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11c2ff45-69ab-4c0e-0395-08d93055f0bb X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:12.1096 (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: DB8EUR05HT063 Subject: [FFmpeg-devel] [PATCH 07/54] avformat/ape: 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: 5bg07OrJhaSX by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/ape.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/libavformat/ape.c b/libavformat/ape.c index a4cfd01807..b6f9be4dbc 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -79,8 +79,6 @@ typedef struct APEContext { uint32_t samplerate; } APEContext; -static int ape_read_close(AVFormatContext * s); - static int ape_probe(const AVProbeData * p) { int version = AV_RL16(p->buf+4); @@ -276,8 +274,7 @@ static int ape_read_header(AVFormatContext * s) if (pb->eof_reached) { av_log(s, AV_LOG_ERROR, "seektable truncated\n"); - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } ff_dlog(s, "seektable: %8d %"PRIu32"\n", i, seektable_entry); } @@ -313,8 +310,7 @@ static int ape_read_header(AVFormatContext * s) ff_dlog(s, "bittable: %2d\n", bits); if (pb->eof_reached) { av_log(s, AV_LOG_ERROR, "bittable truncated\n"); - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } } } @@ -327,10 +323,8 @@ static int ape_read_header(AVFormatContext * s) /* now we are ready: build format streams */ st = avformat_new_stream(s, NULL); - if (!st) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!st) + return AVERROR(ENOMEM); total_blocks = (ape->totalframes == 0) ? 0 : ((ape->totalframes - 1) * ape->blocksperframe) + ape->finalframeblocks; @@ -347,7 +341,7 @@ static int ape_read_header(AVFormatContext * s) avpriv_set_pts_info(st, 64, 1, ape->samplerate); if ((ret = ff_alloc_extradata(st->codecpar, APE_EXTRADATA_SIZE)) < 0) - goto fail; + return ret; AV_WL16(st->codecpar->extradata + 0, ape->fileversion); AV_WL16(st->codecpar->extradata + 2, ape->compressiontype); AV_WL16(st->codecpar->extradata + 4, ape->formatflags); @@ -366,10 +360,6 @@ static int ape_read_header(AVFormatContext * s) } return 0; -fail: - ape_read_close(s); - - return ret; } static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) @@ -454,6 +444,7 @@ const AVInputFormat ff_ape_demuxer = { .name = "ape", .long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"), .priv_data_size = sizeof(APEContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = ape_probe, .read_header = ape_read_header, .read_packet = ape_read_packet, From patchwork Tue Jun 15 23:31:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28334 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4310976iol; Tue, 15 Jun 2021 16:34:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysdknfTcKg6PzaVpVScI+fTBJqy115uTmrd9rY9KdrPSkAvBnt2/NPinyMjOhySW2ux2WM X-Received: by 2002:a17:906:9419:: with SMTP id q25mr2026349ejx.341.1623800067394; Tue, 15 Jun 2021 16:34:27 -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 bc3si251811edb.214.2021.06.15.16.34.27; Tue, 15 Jun 2021 16:34:27 -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=rRA4Rp5t; 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 0131A6899A2; Wed, 16 Jun 2021 02:33:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2012.outbound.protection.outlook.com [40.92.90.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ACCC66898FC for ; Wed, 16 Jun 2021 02:33:14 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D36VbifpHeozFO06PnOI+Oh1lDpXpNDO95XvXA94eavFRtWg3MEDoyWBSAu+jkBEYADcqNHw90tQLcCJsiC3Y+BepwIhQRrXSPaVtsXCi8WKhhL1lQ/PLfpg5fNGi1vGUllRxO5WOgdig7H4apvzCVLrIBYnEjwMrDlLiBuyhWWM48FgDgVSz8TniTMIc3YS9eu9nIjEy4nu1uzW5DjWFnFyxkGa/LV2qVirkLTcVPZA92tWzq6wZcuCzfNIWXhXQDXKbaHHzTx2jDBJyMS6NIWOU+hRZoFies9UNOc4EsXfMnLLOfBuLp2uVvHFXKrS4tOysimgJg5kqDbMNC/Wig== 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=vPXgG1BX7ToP+npp2uUh7zXMD3NIzcu2cA1g0gLPUAs=; b=c8yLRU6tHc9MaUtB6vGMZIRGNlEhXLWp5GDEBOVxLo9Yp5PAvKGWZ2DHPH8lcmVvHh58H2Kr9aLvX/dkukVDk6WzF9TXdjknsowZ6Wj5X74CYKJ9NMQd3FtRKy5Tc6vX8WSn/3zDK9F/yZUmF5OPJNRltWVo1fNHLxuaQbGbWo508gkeUFfWYNYPmrR/LZ2gSkbCFLdZxSAVTYhk0ULVylM6R69oKaSeCRVFSw12ar4dBOLu3NQmOUeI4Ons2K7v1HswJK7A3/EsTOLr3x4Cbtzjnu4ZvDR9z/NpAtkhX8V7nlGQ92gbdiP9vcXQED6UUKWOIBGIXhuXCy9o5ADnIg== 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=vPXgG1BX7ToP+npp2uUh7zXMD3NIzcu2cA1g0gLPUAs=; b=rRA4Rp5tpd82qfSkvaNjQefBc8oZcRhLEYUBN/A4dEKYLrDO8J2KN3HZKc1PlR6Ntx4mKdDm9xj5OLUHQSHHzXyHkObuoCGF9cm5V69q+2aiv2kwd07ua6H+MKZw1ls8ZSZaMHR/88whiSH9vmoqrvztghnO2t8FKbXDim+JpsyAQMOTiwbmkIsB6LPB6V+q59s0abdloXW8Mvg5G4kt8f30kefQmqU+pmTEjpcFbES50BhmAS8s72rGGCtbQwNbFoIdsQOeNPRuJH9kA9SvDzTSvYO13cn7Y+W0+aBf+RXhkK/7O4q3Ir4ewudUAJWt9G+ONK9MkWp0Jy67GAYLZg== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::42) by DB8EUR05HT096.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::80) 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:13 +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:13 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:2F5F54B9D4D59FB1593B79686715F49BF415A80DF0632830F98676CB516922AE; UpperCasedChecksum:3A073132D5493CBAC3A12765D6984143FD3CE4FEDBC3499062CB2918160639B0; SizeAsReceived:7596; 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:13 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:31:57 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [lJ+yHNGl5JXzW4koG020kUOOdTAYillm] 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-7-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:12 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 1833d5e3-5b1d-43bd-3d1c-08d93055f187 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n7LELivV0hd94OsOoTMDQQ1xFW1CnKvcl+LTZFSCwpb33RBomrMMTf2dsL4TnHnR2e3Rn75zA37qzR2mtE/dZ11M8QoGe4c2nsVNppbob7NS1ZNoNdo8RSysI9oTz9iWH3qe7bjkeKl/nkKIYjmajp6QwyHHEMOjptuCU53CTW6/2lz/M+H2uugyF7lkXcyISuaqs7YzaJLyF5Pksa5OwhsC0Sx3lPySwh0DGOcGd2JPSTHvG/3Ck+/6XKQA5gyxVeGMOAxv6d7+2w/G+clA/Iu1yRxvloeZP6QFHNYGmSF8g7NJNnFO8ceqjV2QpqT3t9JySZ3y3H/Rb4OhmyTMw2QFJ5q5JXThb2YO0+HG4nBJptvw6hF2hRh0lzb2DcQAIv1dCRI8FkqfxHXIgtK7p1ityeqnU8ih0CDjMfGYMQ4tRwgcGd449p+rYjC9IiIanZSuDoBz37uFHl1A6Gqb6tdveexrUJ/uPo/FSeFSeAXKJWrHcbWuObWMMVZGvRAZhH2kIPO+TNfFVtEbKeErnHtvpJF9oclW/nwSh+EVFHYLY8u+KX8Tlmn5YZcK1GoxAWgL7gBJSo5knOA52BZq8LH2jWqC5a0FwEZ6hHMctiUKo7kqeb1vLNF2mzRSx2o78El7M/9BuNYdMWWRP3oQMvfTiTxIkH3ePAMZ/w4PEG9YlCEwjutXLG2OK12BZBDDZSh6FiF56arbT1QcDnK2iYLw7wE4MEQSlI= X-MS-TrafficTypeDiagnostic: DB8EUR05HT096: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OS+ZwJVgH1y/5JaaJgijAj0BwBpLZd1ejBaG28ns0wClecq5gWv+rbNQC2WyyjudryE05OF4C3JgtwLCeWpMzOy8dSfVCP/PdKjhkIkrH1Y0hxUQmCu+VrumSTiO8m5VPTw45yFJubIeDe9vKkZG8Vb+5uIuhkAfO9NUeIoBLQNX1QsAPe8uDzUmXL5Gjfz3tG6iSpxibOrz2WXxhZLttdSWfYWwcEBuC9CvKZCywBVjISk6K4n7pXx42dCQHJgRJnBE4LgNn8vVjeGOAk9cyMsxoh4aJcZZAFRWPC2/nmmOS0kS9jHnj4i3jkf2EwZCqy9ypCtd/GH3KslCygtBT1VtP1bvhxp6S6gwL22lVkFjO2WlzwHcB398OdTieR3YLCGglb2hMdLP2tqtNGzT0A== X-MS-Exchange-AntiSpam-MessageData: f7xKVconb8GJjYTZwhnbmzkq6e/s/zJSRzVRO6rbMufDwwA4brZ940HpAGF3N3gkXbua6m5DavROTeeo6hEuUDQVJBTg9DCj1v+Q+nRMvMmbNR6a/qiJNEXVFpC8xwAwkyzFkmk/eiLmZ63N5D9DZA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1833d5e3-5b1d-43bd-3d1c-08d93055f187 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:13.4500 (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: DB8EUR05HT096 Subject: [FFmpeg-devel] [PATCH 08/54] avformat/aqtitledec: 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: DLo4GEZJsjc7 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/aqtitledec.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavformat/aqtitledec.c b/libavformat/aqtitledec.c index de28097f2f..a37c9bbeaf 100644 --- a/libavformat/aqtitledec.c +++ b/libavformat/aqtitledec.c @@ -81,11 +81,11 @@ static int aqt_read_header(AVFormatContext *s) if (!new_event) { sub = ff_subtitles_queue_insert(&aqt->q, "\n", 1, 1); if (!sub) - goto fail; + return AVERROR(ENOMEM); } sub = ff_subtitles_queue_insert(&aqt->q, line, strlen(line), !new_event); if (!sub) - goto fail; + return AVERROR(ENOMEM); if (new_event) { sub->pts = frame; sub->duration = -1; @@ -97,9 +97,6 @@ static int aqt_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &aqt->q); return 0; -fail: - ff_subtitles_queue_clean(&aqt->q); - return AVERROR(ENOMEM); } static int aqt_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -141,6 +138,7 @@ const AVInputFormat ff_aqtitle_demuxer = { .name = "aqtitle", .long_name = NULL_IF_CONFIG_SMALL("AQTitle subtitles"), .priv_data_size = sizeof(AQTitleContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = aqt_probe, .read_header = aqt_read_header, .read_packet = aqt_read_packet, From patchwork Tue Jun 15 23:31:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28321 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4310382iol; Tue, 15 Jun 2021 16:33:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE3XUjDqyBAlRTe0QpHNOP/KgYm7juWE8Y12T20LFEkZlurBXi1B/qHguLQrmGnuvgkmFn X-Received: by 2002:a17:907:9d3:: with SMTP id bx19mr293679ejc.429.1623800029353; Tue, 15 Jun 2021 16:33:49 -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 j11si409356ejj.109.2021.06.15.16.33.49; Tue, 15 Jun 2021 16:33:49 -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=lDYesaUj; 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 C274D689815; Wed, 16 Jun 2021 02:33:19 +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-am6eur05olkn2101.outbound.protection.outlook.com [40.92.91.101]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4D0DD689248 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=kJJvgypQf7a7zb/BZlEWwXujfsForA4Mmo6LKHOQU/NBHb8KjC34gs7eNIfDyJ4b7EJxyr0SsFzscS2uwp6ldgFpvRf15sFnSrwhwo/jcGl+bJiQUNjjf6Q38QyK+ecnv7OY/HEO2vmP1JpDwTOX5QxXGXAN5+L0YZl3Df30Uke419FnuYsg0aL+ct8WdO3MI4CHFRRzXauFTvXc+04uZ8UWOn+oByXXiZeAEuectnK9OqzS6fDVENHkIKTDEhzg3tkF+UN2AzoUROT0bIr0d7a8LqZOBwcm0sGatBjBjRLxuJ7crPVsdMeOBJfwtjVOOi1nLVhWQG5kqYjTyoV5Xw== 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=JEtEDN8yoKMniQaeZUlwbxSEDVDJ8yS3Vjo4khhPQL8=; b=gSZBvOaaUNcwNdzLedwoGqL2mdsLdI02iO4uWliTFjHS55LFzMda9HuqndvsQF08eXGMcAhfzO1AuU7JwtGroqVFHiNE6h1ICAEpHtrVEGU1xrVYMpgIM/GlAHlWFymtChCGpI6Omf8kszxgYdekUtUCM9zihERJUSWDR3CpFjBavfeGUGx+bh1C1/A/q34FYYD3KibsNRiP5mXUpZ/WXH1+qcuL3cLXKV779Rk/Wtdk6E7nKfSD20tqIjx371wHIdzXcPHISeV5lMSLTV3DUv3f8Ui6kK0aMDGWV/ZT5/F6pU7fuUH3nPlQHQUPO+fU3wAIwzKQ7KKCAGBmw8lQZw== 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=JEtEDN8yoKMniQaeZUlwbxSEDVDJ8yS3Vjo4khhPQL8=; b=lDYesaUjHzYTC3EytDSR+NZybCvRpJIxIzp+AxELe5I43MIVX1AbOYhxCQdjkOwFPbrv0C+tL5Q1IaWC2A3nl/ZR/xttE9yHOWxc6T7Cogcr0UwfHlo7ly7nwdqHAfyjA5JESWaQfTnAcp/q/1aRPlLsGFVMA4tY8zEmQGF+v/EHSxG83ybS5h/MdI59jGl11aGgEj5HMW1kpLtogestNrBASvUWCZAZBtTSkOtlZMw5CAY+XWmSYgxhnfGH/UnFplcR9efdamS1oG0PJ/7za2RG4qn3gCCL3+T3DqvttGAHsZYWvUHelzFFp5HKp1pavt6raJOx1JOaG6SOD0O6BQ== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::48) by DB8EUR05HT012.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::139) 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:14 +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:14 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:AD6F13BF3089D41A15CB11A5D35037355CBE42E096413EA93B0924C212E2DB1D; UpperCasedChecksum:5592B799A00EEC5F5BE588EE5B4C1C8561829CA40A92C708359E7AF11C49614D; SizeAsReceived:7683; 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:14 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:31:58 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [siQFTsj6s5waF5Hi6L+twmG0U+B+OT9N] 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-8-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:14 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 91d78838-7836-4ce4-dad3-08d93055f249 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk92w3tzm64AvbWP5CJtYQNbKsxgxpBTv44W4kbyxV/OBixgl4j0wKVsMq/lZaNtX6QLutSjn11vR9ZOjwVnmRV5rhERo88+UcfL4Bx8m4ozjzr2Li4MD/BqvfSkuEbiU2ECnXoYH6BX/cGL+gewe98icPWFhFll1shzerh6gftP2mhH25x8WZQN0NJzt8bPqFXvwvO5hJFYxPBwdRGYGI7Gicz7mjaNWiYcQ1Hg2XGoYEW7E2XOald9Clvc2tgLp1FQQ9nuHojrT6ModZxIPJH3s3VU95z4U7hCuWamIBlZVzwHx2c4UlcYn0Dfft6TyUHihigvFZpHREcDuuSQym8jYeJRUnQA0djn4psslBFL9S8AD0VQ/9GXtigWbe6f/uzaHwAqJ8E0XcC4tCM/QhU4OcysoZN0X9+cP9xdUmxPbuhTn7QyVzPKSLEx/0dSCx+a0b/Z4fIZAB6wWlBE6iHpsHm6jvW0zHeukZvBOxK/ljVFT9WsmSocIAi3iUqBdLpaxFLy9mmJ4DT+t8kzWbvvIYyMTEtQI25n4NhlA4UQZmYQy5+f8P+OZhmnZtCyewDPHnX2byWS6yQg/M+g4obIaw9TbcU+nv/8/lG+MFLUiddJyKf8i+2AGeNH/7suQw/fwUAvn2+qYTgAYXo6nntXjS+RrXOCgECnzuEhy7VdHPJ7Fv8qmPybrtIubi5PwErDqmT5/eHmNh1QYHlCmI8TQtUO0WR0How= X-MS-TrafficTypeDiagnostic: DB8EUR05HT012: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uQmD2TRASgUK9prUVThG8HSGhVI1GVQv96OFVbTDXIRR5KaSb5xilA7/U6aZzxbdvU3gE/rsyt59kpoemGJ+vBzkTN/WUaX9ga0DI2+ZKS70KEssQrAwQ9YC3zTWwRkeTHoVeqnma3dfB2op6zJleVsKUXyITbbAhubVpDOz1agZQEslFO/er65CTOLrfV9S8ZWXG+Ll3SW5WmK6z3DuOu1acGakYMhFR+zGd1w0SlkQRHSlvVJYoiw1/QNUPWeyXW6rdp9dFLJBnTHUXgrA5RnDmBuNTaM2kqsUmNWGkYKHnEvbQqPkxouO3jUbzoHkw5FwJuyW6w+Tsl5/hgZ/Qo6qmLyDXCw8yj0KdYaXPFNYsOd64ppPTDk/EJJbUe4D5JlGz/q5CRHvt7EBQK7VGA== X-MS-Exchange-AntiSpam-MessageData: 5WWE18+u8tu5LQyEoFgc18SuP2kYKC7GywOBUomftGD5XoBzhozFxUafLfPwLT70FDMVApQ8h8Vw9vUcCEcNgBaeJ0l8eqAjXK6cfYsEWDBP6eQJXaC9C277phiNBT3PpRfrHnxn++BKiaU0ijmbMQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91d78838-7836-4ce4-dad3-08d93055f249 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:14.8534 (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: DB8EUR05HT012 Subject: [FFmpeg-devel] [PATCH 09/54] avformat/assdec: 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: YsJC8Chj/CZU by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/assdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/assdec.c b/libavformat/assdec.c index 4a9650fe76..5f71fcb024 100644 --- a/libavformat/assdec.c +++ b/libavformat/assdec.c @@ -160,8 +160,6 @@ static int ass_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &ass->q); end: - if (res < 0) - ass_read_close(s); av_bprint_finalize(&header, NULL); av_bprint_finalize(&line, NULL); av_bprint_finalize(&rline, NULL); @@ -185,6 +183,7 @@ static int ass_read_seek(AVFormatContext *s, int stream_index, const AVInputFormat ff_ass_demuxer = { .name = "ass", .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"), + .flags_internal = FF_FMT_INIT_CLEANUP, .priv_data_size = sizeof(ASSContext), .read_probe = ass_probe, .read_header = ass_read_header, 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, From patchwork Tue Jun 15 23:32:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28410 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp122967ybk; Tue, 15 Jun 2021 16:34:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuemAgPZk6xbaCDM2XeqE01pwfcOy3NRSX1+mHuCAB68BrFijXEEgg0se7psRar51Xhe7S X-Received: by 2002:a17:907:960e:: with SMTP id gb14mr2099594ejc.231.1623800055053; Tue, 15 Jun 2021 16:34: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 21si446474ejc.63.2021.06.15.16.34.14; Tue, 15 Jun 2021 16:34: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=vAEEfl1p; 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 ABFDF68995F; Wed, 16 Jun 2021 02:33:22 +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-am6eur05olkn2011.outbound.protection.outlook.com [40.92.91.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7F272689829 for ; Wed, 16 Jun 2021 02:33:18 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=drBqNptiTgEKv+Fi1TrrFSYauzuP6qtdzLFlU80VblbuJlszwde+frYBDM0evscRAxIYdjhoKpAw8DREEXG5kNrfHtc/Dh+2WD2TlByp1rdfcZfCuWeZmAjpo6MbE4vG3nqdYz2hf1s1dn/a45nHR2IwmoQnKjJfMW2GIckSfA4eimYCSyi0c3nd3H/HLzs8TOS7tae175qB7TlTn4EDrbqVA1Y6aLCdT3gYPLoX/lT1rCcFO+4/+XXTtz1kqvmiB5BecGgsVv+RkU0nJ2Myrf3caF9syrVGpCpcW7eI4lvkHqvYKLOg/r6oBfCdeqcjBzi3cUuFIvbVF6uxI0O7ug== 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=qV+4JnuqYfs3oZo//SqcMJEK4GYqvjMPzBr2J9iDOZY=; b=ejQXeJyXrlkE0/a4Njx0OaiwbtliIlQZtYw4fvyXDeOeBJCtHo3uJ2aDAmRKFXrgH6wB98gZaBpJOj3SuxhBSnhtHcLrFwiW9kA08UTHwaVtKV2JslHwi/2dKjoiTAuOcWhWnsy+sYk28SAF4Yl35jB7dnikGYMXCBeN3jFKOIKGVHdQkgi8hrjV6Q9fApCkyBlYZvI/B5myeUOLvCLpuw/1aKZMpzbQAAlK9HW2+fvi3nrVP4thsUK2kJOrOvcsXKAxAGSwG9d1d/zTrJRInfv6XRfahY5Fa44IR3A7CiYtPNF+HbjDcwdtfrXHTnObtYzFAPXG3kcwkVRomlKkiw== 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=qV+4JnuqYfs3oZo//SqcMJEK4GYqvjMPzBr2J9iDOZY=; b=vAEEfl1phgmgQPCMB96YCJ6T/fltdH9mGCO8q8h8JHBKt1ZJLYn8GGjkW8M/ntJqgPC3kCl+UWEBmuBg6En2rARtPcR1meF+Cxz5/rTznkWWzWE7tz2uDv2Rs0i1uQffuk8CT1ehSCYttxqGL9uNHByRFHhdQVPJIkqpTSsp13kZsUCy9G0gYamh7eaaM4Zcb14NbxUibr0blmEjZKLzv9RLrjUNr2FFaNZHtZdX3B8glh55MuOOQd79tJjssJoCrrFSpS+27zO1SAYGY7OXFAcBFkdzdrFs59HHe0egqKxLjwfDME2QiAcadPq39o/Ur1ya5i0hf3tmzHrb6ePUpg== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::50) by DB8EUR05HT206.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::360) 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:17 +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:17 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:45B2C5D2C2131E3B8D2485CFEF795EC39A12F357250E84593D705F45526F10E6; UpperCasedChecksum:BB071C7972F1B864662D7ACD8846435312DC9D0464BBB770C9E8CDE587B59841; SizeAsReceived:7593; 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:17 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:00 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [yN2hwUl1UTUKYXS9kcBqpVD4mvi8MqLg] 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-10-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:16 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: d0c35e47-a1c4-4a86-3a7d-08d93055f3a4 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pWhkGqqrkWQJ/G2nBDhW1VuCUfUvgQwiH7rget1HUOjFrEum45Hm8dWYAtV538JTZwhqZNjdOo4IcUa+Lq+UHUrCDOk5Sio4+/uIaigbsWUylUcHsG/kePI4T4lpYp0zfa2NRu/bY1sxU7iHsEwTCtfThjyyK5/mK6hQ9n4Ntv38QIxdf9VB7LzwBVV3XJjOWmAo8CN06WdDL35uCTEqOsZIx81vjKOxEGmX+Dv3Ur6nMrZW2uM778xaIGhQY6pG8nyEWnw5/DBNyXFgtXiUDADGkFx5/O+liqNpCM4fLqD6meANen1S3j3zekdC3NOah56LuArWb/Qf7qZFIZ5N24TH/ufctWcqtoCfpXeAtd5r1p55sGH7nXXbFJ9kGUMNWsGVSJNB1iQ2GJINp3J3bhjN/gNisg1PuAvkxia7cgshuIH5KYWymdR1njLISQT29bIPAZqKRu3wCmTKhH83Ry20z1I9IKDi0IVTFoi+T61XtCFsYnT1sMToQ5+Y1CONaBKC36lWPFPgCI3erXKyhCi7gzAOkyWsPoGnEKqcLbT94/dRxAlQboHPEjZcnCt78goi4S72Ufb6shGjzEGoAOBBg4ydyUtDNloKLKr/31PFwbiS5FSYgI0AYYdm/yGTCSbFUGwoWoEeig9oRya1Sx/2kUfhOHlicKLdM27Yb1KuKpXdjdmHPO6h2ucYg/ymqFNADqMcl0gTQrhMjC5qgl389BBMm0ryimrTjrt5otek= X-MS-TrafficTypeDiagnostic: DB8EUR05HT206: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yiF0yBVSbVEvh8usOmlZ65yGGqfRPY2VMymC+GUA/rlk1DHcfY3onomTaqBR8CEK8a6hDANWXFynOIi4BlmvwvQn1EZtR4ZT6Arr1a+mrmNL0tV5g084iXLMZNJtxv2jyVeAFhVlX05204Ln/MWUtd2SXqNaENR/QpEOdMJUHGLOodWhLUt9VZt0tH7Cgykxb4XseQdKnwNCmtYzP4uvqw9bwLy5cRZAbd7bGr2lMYeUSwOtoHxGJamwtvCjMUv/ZWK/chvY9fPz9DUqM6sEwr3pxnZHlPFacvCXbuiIAoABxIXfkYZSUIwJzWgeOMp3vDy/vwd6y3w4Xfmvqq3vkQ9AS+Y2sG8TCw6yxcLg2VOnR16wi8Ko7/kVo3Pxg/YI X-MS-Exchange-AntiSpam-MessageData: gYpL5ze6VGzfjLtatAyetbpjDwzR725AukVZgepjHAShyyLlmbYD4XtG5uXHHn/TtCG+UiaQk1/VfrpmaMlc/zHF8Kp61KIlLnxz5LscM2oa8Lt/u2YF14iKA4Lz/PmGOu5lZbA5g3NDKLsxjcwejw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0c35e47-a1c4-4a86-3a7d-08d93055f3a4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:17.0584 (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: DB8EUR05HT206 Subject: [FFmpeg-devel] [PATCH 11/54] avformat/brstm: 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: 9TfQyYrMgKFK Content-Length: 4502 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/brstm.c | 44 +++++++++++++++----------------------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/libavformat/brstm.c b/libavformat/brstm.c index 601f73dd33..338491d9ef 100644 --- a/libavformat/brstm.c +++ b/libavformat/brstm.c @@ -104,7 +104,6 @@ static int read_header(AVFormatContext *s) int64_t h1offset, pos, toffset; uint32_t size, asize, start = 0; AVStream *st; - int ret = AVERROR_EOF; int loop = 0; int bfstm = !strcmp("bfstm", s->iformat->name); @@ -288,30 +287,24 @@ static int read_header(AVFormatContext *s) if (!bfstm) avio_skip(s->pb, pos + 16LL + b->offsets[ch].offset - avio_tell(s->pb)); - if (avio_read(s->pb, b->table + ch * 32, 32) != 32) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (avio_read(s->pb, b->table + ch * 32, 32) != 32) + return AVERROR_INVALIDDATA; if (bfstm) avio_skip(s->pb, 14); } } - if (size < (avio_tell(s->pb) - pos)) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (size < (avio_tell(s->pb) - pos)) + return AVERROR_INVALIDDATA; avio_skip(s->pb, size - (avio_tell(s->pb) - pos)); while (!avio_feof(s->pb)) { chunk = avio_rl32(s->pb); size = read32(s); - if (size < 8) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (size < 8) + return AVERROR_INVALIDDATA; size -= 8; switch (chunk) { case MKTAG('S','E','E','K'): @@ -321,19 +314,15 @@ static int read_header(AVFormatContext *s) goto skip; asize = b->block_count * st->codecpar->channels * 4; - if (size < asize) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (size < asize) + return AVERROR_INVALIDDATA; if (b->adpc) { av_log(s, AV_LOG_WARNING, "skipping additional ADPC chunk\n"); goto skip; } else { b->adpc = av_mallocz(asize); - if (!b->adpc) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!b->adpc) + return AVERROR(ENOMEM); if (bfstm && codec != AV_CODEC_ID_ADPCM_THP_LE) { // Big-endian BFSTMs have little-endian SEEK tables // for some strange reason. @@ -351,10 +340,8 @@ static int read_header(AVFormatContext *s) case MKTAG('D','A','T','A'): if ((start < avio_tell(s->pb)) || (!b->adpc && (codec == AV_CODEC_ID_ADPCM_THP || - codec == AV_CODEC_ID_ADPCM_THP_LE))) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + codec == AV_CODEC_ID_ADPCM_THP_LE))) + return AVERROR_INVALIDDATA; avio_skip(s->pb, start - avio_tell(s->pb)); if (bfstm && (codec == AV_CODEC_ID_ADPCM_THP || @@ -374,10 +361,7 @@ skip: } } -fail: - read_close(s); - - return ret; + return AVERROR_EOF; } static int read_packet(AVFormatContext *s, AVPacket *pkt) @@ -485,6 +469,7 @@ const AVInputFormat ff_brstm_demuxer = { .name = "brstm", .long_name = NULL_IF_CONFIG_SMALL("BRSTM (Binary Revolution Stream)"), .priv_data_size = sizeof(BRSTMDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = probe, .read_header = read_header, .read_packet = read_packet, @@ -497,6 +482,7 @@ const AVInputFormat ff_bfstm_demuxer = { .name = "bfstm", .long_name = NULL_IF_CONFIG_SMALL("BFSTM (Binary Cafe Stream)"), .priv_data_size = sizeof(BRSTMDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = probe_bfstm, .read_header = read_header, .read_packet = read_packet, From patchwork Tue Jun 15 23:32:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28333 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4311099iol; Tue, 15 Jun 2021 16:34:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzCuw2Ug2JmpQ31hgNzWqkGlrmyqRQtM0QAv3xaywMnGlh0DbM5WNcca8EpC1lMJm41C4O X-Received: by 2002:a17:907:2642:: with SMTP id ar2mr364040ejc.391.1623800078428; Tue, 15 Jun 2021 16:34:38 -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 v12si272815edw.236.2021.06.15.16.34.38; Tue, 15 Jun 2021 16:34:38 -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=Uj+slFgE; 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 0AC6E689905; Wed, 16 Jun 2021 02:33:25 +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-db8eur05olkn2034.outbound.protection.outlook.com [40.92.89.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CDC7C689910 for ; Wed, 16 Jun 2021 02:33:19 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RsOt5yr27qJV6pLD4pDAm2j8oZL2EMYZyR71YL2gcjpb5/O5MP2gaCjzE+r+FNnpvgtmo2QmM0lqJYYlkQkRLjwUxYjjz9RJJD7wGH+s2OvTnMOe5tvRrO0h2qopmdkRCzV4oKc8xY1tb+QMGCHihFMl4LJ3m9A7NCGKvSH7NXv5iPnJsxCMIX2FcVB9fgTOAqig+tlU09eJOoqBmD9qIThEK5oRmIZyH2fYPd2Wdcbz3IFXZoE6CwpF6k102UmfB9jFeBEEDBCK6OZc9MQENYm6uzLHM1ZCxZlG6Jk4FGN0By1f2SlOTjHSV/HYteluPOLeHo9HQuKvy+3y57rChQ== 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=1eRbiY8P3adJQk2ZDHvwRqaUyAFf6XpHQzEInK7Jy4Q=; b=U4hHJhnD9c5XpV0aicV5BsV+VceMOLACmor3LZHFNPtsU9EKXoCS12+afvdnpLnyrkJXi1oV2CoTFKDVwn9NK8uNtAOmlLI820Vi6Karq0Jd7Oj4U/KbCEoSzaXYjOMfg8jS8/odJ6PWZuQdchRh/4roQd0KQA/NnQxL2qMuDrn1XFPk0My22OIh8iDzzAGBRZXP8IcanJ7oIpHsWYKqajTrDiH0NeMmkUgmraXGNjpOQQ55Reu7EaCiGZ3Nj+agerLphkK+pgLV4sMExh6qMMChs+boboE35M6Md+Vy+yfc9EsAYAbojvOG3OlUA4AD3u6h+hX1q7DLszRkUL0D4g== 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=1eRbiY8P3adJQk2ZDHvwRqaUyAFf6XpHQzEInK7Jy4Q=; b=Uj+slFgEl1naadsPXGfVFejX+KQFIpK4HU4bPUbI+k60PPumAqSPx0bgW+LXeYcBErKuGoyxegn1VewcJBfL+ctpFsIvZKcFfBU9IE7rsPJvELQ19oyegeDr0Q5U+XeN72IGvhBjKm1PiQYtA0EWNHTdCICROfFTMknQNCeyA7Lwsw23NBip3iroRlfY3riXSiRFTWdmWfeqqRiW2VAqZ9ONWDAvobrd9qQQ3gqNHE1hXgz+mhlVWn6pLLTG8ZEovQ0OwSfY3IHUcG9jYF18E+ylPCdQdLY3vFV7XafKND0S+RrwnGWyuq4CSiRV0y3Z31uNI5mZL7fStVBGDY5+Pg== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::45) by DB8EUR05HT230.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::116) 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:18 +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:18 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:01F13D19C3C63FB9F220236BCFAD5144150EF7FC1C5480F17C77F0AED9784C49; UpperCasedChecksum:7E52596A22A38BCFBC2704F851D33B67C8CA426F1C5017CF6BB32E48962B1E70; SizeAsReceived:7596; 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:18 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:01 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [UJyvmvX7wXXg0e7QClNAl555Hu1RJlOC] 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-11-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:17 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: dac01be9-1714-414c-caf0-08d93055f46c X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n7LELivV0hd91wqBnvij8hMw6UuNV9V4KMccF38yJ3HF+dDgTUcXcMdtI9TijfG5YBiRWAUCWsXtXx5iXrw6n0zx7Y+MmtIRNXfqWQ+IZjjBgfuAUD+mTMu+GgdIODj6J7WF5bMiNHCcLC1c+67mHV0JOGT+g2h6fITpmo2bzIioM4xU7oEAXpCS/dZGz05q8fgBZdd2xmBoxr4L7/vGO2RenvlOVel3ls4GzEELi4dFQnwzP+7s7cqjy9v2iQqWMos2155YRG5WEj9HW86Ll+AG5WS2TAARkhkK2rLr7/uTOAA4vd/C50cpVB8nWHSYIK1ft92/HARxQOntzUjONDThGd1uU8YCFk/ZCdeTmf2mX3FYz558ZXHOpK9Xm3qd3Gp8+FDS88bWcJ76qTzlE5aWfB6hZn+zNIgZkhc7swUu/UkW8f74z5WOKv3unUTbugmvIHGMYVJ18sZ20kOfCNFZZw9+pnkR1NBR0zrGIE+ikPaEp3lzy/GKn6Ql1Juhs+7mzNZbySE82FXZRyrfS4+r6E0Orfc6NUvt66BokiMNT48NMSGlz/Y2vTWAe10Y7vM6WGVvuxypkvbqOqs/6Yn8rpdmz6X3Wc+zL995k75DNfgmDSKVK15wZtcsyJfmIcy4XTub+MMcKUsUzRrKWW+LUZ07bY1qQ3FtJoViRzfZKMA/ckl6fo3KrvyszzMiu598TNkote05A5kIG4wzzdR+W0fQFE+3uM= X-MS-TrafficTypeDiagnostic: DB8EUR05HT230: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iknWnm/mbFQCU0bFkf/PTjANtVlMFDbBB23ebHPRfvGFoHD7lDziVsFKP7dLjK+F2hRCdqWcYs9TGirZuFFKM/caUMOIRmitpqOTskQGHgQXUrIK8HBcKWwmRPt1NmdxLZ8jtfjgNraNMZift0bwu7UL27VuKml9nagVcZor4g/RW5V0XQn6hPfXUizQnWCs2lmha/0kqUOWKQu+htGuazu+wDuU36NG2zRX4gLGApyPrq9+RtHanCGxtNG+qgNVO7rO+yx+0QRJqkgRqWvIvUyt2Lw1aWnOk/qafrdeH0euU49WSd9Nlw3+ZEqy+lu4GnGMbYfl/tRVv/y+uTZ7MR+jb5nDudrkfFXbA7peq+rPXciKj8LcS/UECoAsVxrBc1uqxSjvUPpFjSO7m4PKPg== X-MS-Exchange-AntiSpam-MessageData: cXK2i2ihVu+1wV1qqMR6eu9AZ75RDgQP33o1DgMcJumwKKST/tC0bOdykaUWR9udMi6XcuFzPymtL/1FpUInYmnATCPvVyc/EhH7QYRB+e5cLRhSUVGNCLbvH/zQ3blrHIjPEHVijZ3xuFbYOGKudA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dac01be9-1714-414c-caf0-08d93055f46c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:18.3618 (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: DB8EUR05HT230 Subject: [FFmpeg-devel] [PATCH 12/54] avformat/concatdec: 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: GWrxfSvLDkeV by setting the FF_FMT_INIT_CLEANUP flag. (Btw: concat_read_close() is not idempotent (it frees cat->files, but doesn't reset cat->nb_files), so this demuxer was incompatible with simply calling read_close generically upon read_header failure.) Signed-off-by: Andreas Rheinhardt --- libavformat/concatdec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 6d77398f48..96b4b96962 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -510,12 +510,9 @@ static int concat_read_header(AVFormatContext *avf) MATCH_ONE_TO_ONE; if ((ret = open_file(avf, 0)) < 0) goto fail; - av_bprint_finalize(&bp, NULL); - return 0; fail: av_bprint_finalize(&bp, NULL); - concat_read_close(avf); return ret; } @@ -779,6 +776,7 @@ const AVInputFormat ff_concat_demuxer = { .name = "concat", .long_name = NULL_IF_CONFIG_SMALL("Virtual concatenation script"), .priv_data_size = sizeof(ConcatContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = concat_probe, .read_header = concat_read_header, .read_packet = concat_read_packet, From patchwork Tue Jun 15 23:32:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28329 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4311662iol; Tue, 15 Jun 2021 16:35:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQJ+zF8zaKR2imMxRloBKG73iHry3Nrg4fdwel5WyCcbYt0J9sEww0DDCuf8qGtSjfxtSB X-Received: by 2002:aa7:d158:: with SMTP id r24mr665471edo.171.1623800132189; Tue, 15 Jun 2021 16:35:32 -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 rv24si377696ejb.690.2021.06.15.16.35.31; Tue, 15 Jun 2021 16:35:32 -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=SVCLAnFv; 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 0D37A689A29; Wed, 16 Jun 2021 02:33:31 +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-am6eur05olkn2079.outbound.protection.outlook.com [40.92.91.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4EB536899DA for ; Wed, 16 Jun 2021 02:33:26 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nn3UmJ54c17RJDEK+CLUNtcTKaTQYlRa1DKzoSFtbaRnvj+WBgDEIwp8ynAvkfJ4fNTN6pjLjW0vO8PvQHn6G6tjZimbiEnHW9iJyBqgY/nfnHkyXxj3JZD08XTfJZC0qlOekKIrJSV+zo8ZXtwA/edMtOAFX1bBDvFRfDrI4PaTr63ViBIWPvENtb/r4LjNluxywWmhOvbdd6e9KC3/wgD8lxmf3lorZdhe6iaAEe8DUs+lHZW1q/c0kBiY1qB/h+oJxQ98N2bqG4MtesXx6PqrHbZ7URmtX8r+VdmWy23Gs65HeU52tG70PGQYevqvjD1DWykoi08DgGXgMsAwwQ== 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=FKPj4G+eF3fkt4xWY9vCiZuc7vEnbiVG9M7YztGrIak=; b=XkX0PibFAuwKtCDZ7qK1ttwUzTZ2ec5lQggV741BwVz8N8lLJS6h7+HlnJryD3G/bKxkQwBoQ/YaSpQBlgQL2Vp3/jM1sohSaxzrU8ybWxo7gGTaGW0GQzJrnfbuwqEVSyy5q3yQ/kkoFj9YlPIPMZllb+3PMta2ddbH2HqRpNIf0w0ZiZP11eAw5rtYUaFPyiU9Vj0gVKhCSjPU0dRBLqSC0HZRTY5NaWexHcuvEdzdLXZwfciJ5e+PDQiBgx+k11Q67mDZ6Qzbq44aHrOmobJWjhgnGo1LqGKVTweRzDx1XD/E9OP7HdyNVJ6Ae7vYChH3okk9KguozF0uVkuiDA== 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=FKPj4G+eF3fkt4xWY9vCiZuc7vEnbiVG9M7YztGrIak=; b=SVCLAnFv9jkptmgJ5A21uRkrmLMIgCsQoDmjdcTMEo+nl1EmWiz/OI7Ic9sve7X9rjFddRVrla4dUkBc1Ky/hYBintUFibA5za6XhSnaKyuzXKEbmxDa0451bFQSqVtq76Kgf35PdH7dCmNnJDqmnaLxPdITyT6lnSLzPzspISqFqUWNDa7BTsQCj+1kniSH97sDw9E3rq7F2avuoG76x4cBan9jjFCsF9GyioQOQycIAs/ZZekhTcGiFO6vaJUB3azRuH12JTQ9FZq8mNfN9YX1kU5QlmhRRdD2Yu4hfubWj9V6fs/8OrGHuXbitYKy+qpTvKeZZUiArE+hrzUg5g== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4c) by DB8EUR05HT121.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::154) 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:19 +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:19 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:6172F0A23303E7A92B8235AC44F52491322828DF5D8786C109123AA69EC77E43; UpperCasedChecksum:77B8B7DA30154C9CC6A653B85B611EE8DB764619E1D9E8117C076D3DE212B415; SizeAsReceived:7585; 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:19 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:02 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [kEIb6h1vcOK8++42pvCC3san1UJb5z20] 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-12-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:19 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: eaed22a2-895a-4f1c-5bc0-08d93055f52c X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4p0OETr0+Jrn2aW1jxIgMYUaObSqmwskCosDNop5Tk9ulp1lMTaYQPkFInZvPm5D64+pJsg4rlxgyc4SIZinPikudzzjc56ZcTCZcAnvApxMdeSTo2TqspD5dbb9kLqKtctQC9fuUZ9K4ANI4amc8yW0bxXQoMKD4FtymuLlel52Yi1SCyTY604ARtWjr4ztp8PnB6t4Rt7/MruaBj/xVJsw9bYcF9/Y1KPwTYHke0SjX8ea3/WMb+0Q0hyH7waDw1DquDXFDHZhkI3Mohcbbc9SCpYxnb1nycm5XeQpHkL6OONXXambLnDBkNeIMspNAp4A4bZR9u1PN8PGHTXHsgYdmSf4sg0ipN4t7cykddoFcVQQKUMRLyo5kykkwGXyLWpixHi5u7xR8Nantikf3h/wdAn7mAPVmureikRfA0dkP5R/7sVYseWaILDSCSJ9EmZkMncFVJWud5c7oMHqsyBB3oWOwx586dnvLi7/PF/xpy8sKvP0RoOFD7Jnx/6iFfspll8cfArkAqJw8YXMQy+1zAuqo9NMzcaIxPvr8JqBaGfLoBf5vlFyyE0QfiqwhPQHzBUwjJAKcDJUeHAR9ByzGf5fS7ptfFs/2ZrWkFlt6OJ1Tq9yrdEsEFf2GTiEgHVc4n/9nxTTP2xjnQWU0H1ofEt/n9NwaMfQJ99u7eYRFFe+2nIckLAxkVKy5fevkv80lCGPKQ0cLugSIiAsnj8DfHfH5dya0oz+OFQsfz8OM= X-MS-TrafficTypeDiagnostic: DB8EUR05HT121: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZtcLoZIG+PbjG9yaqp0eUgZ8yxTiBnKRqPx/obGARR9GKwmtb4zBLx5IlpGpBCpx7jAOK4M9kZg9KYoUTvuXSeqd2jSldXg4uXK1PMafLNKH9yHs9sxLh55oK61cgYsG7F0iENdp1Gxuqp4jkjG5dSlExGHzTSeenukBmGxtXN7oIdK/v4oRvT50daXuK3B0k/6ByySUiluhI9aQz3JiRti6r7NnT2x6pXNYXCFfvOv7ArfyRFbZv3VKZye0/1mNghOZLUd2VQJYkQG7vxTCcMl7iODGVsYSs8dae0QjCXmJlG64QlFW4Tf+QcMvXhkE+Aeln9SlWUH3VL410d5IpLGqfcdnkMwUfeNHvEWdDWXmXrGcgg0ffZWFD+0p4NA8oMiZ2CpaPEWJYwD1/bPO4w== X-MS-Exchange-AntiSpam-MessageData: IOm1rOU+OriVgZd41SZoiCiQOwtEtUl4/rVjlPa6kHOVAeukitAnlG3PGpYb6sRrABsCt15ZvHPPVu+S8OOtlnuXvNklAR4cPvFfzsrjoRFWhqaFE0jxvw1gJt6ZCmMDsC1l69Sso2aqVwwnVyDz6w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: eaed22a2-895a-4f1c-5bc0-08d93055f52c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:19.5743 (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: DB8EUR05HT121 Subject: [FFmpeg-devel] [PATCH 13/54] avformat/dashdec: 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: Xc+wSBo3oiFz by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/dashdec.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index bc27c96c97..11966f905c 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -2037,8 +2037,6 @@ static int copy_init_section(struct representation *rep_dest, struct representat return 0; } -static int dash_close(AVFormatContext *s); - static void move_metadata(AVStream *st, const char *key, char **value) { if (*value) { @@ -2059,10 +2057,10 @@ static int dash_read_header(AVFormatContext *s) c->interrupt_callback = &s->interrupt_callback; if ((ret = save_avio_options(s)) < 0) - goto fail; + return ret; if ((ret = parse_manifest(s, s->url, s->pb)) < 0) - goto fail; + return ret; /* If this isn't a live stream, fill the total duration of the * stream. */ @@ -2081,12 +2079,12 @@ static int dash_read_header(AVFormatContext *s) if (i > 0 && c->is_init_section_common_video) { ret = copy_init_section(rep, c->videos[0]); if (ret < 0) - goto fail; + return ret; } ret = open_demux_for_component(s, rep); if (ret) - goto fail; + return ret; rep->stream_index = stream_index; ++stream_index; } @@ -2099,12 +2097,12 @@ static int dash_read_header(AVFormatContext *s) if (i > 0 && c->is_init_section_common_audio) { ret = copy_init_section(rep, c->audios[0]); if (ret < 0) - goto fail; + return ret; } ret = open_demux_for_component(s, rep); if (ret) - goto fail; + return ret; rep->stream_index = stream_index; ++stream_index; } @@ -2117,27 +2115,23 @@ static int dash_read_header(AVFormatContext *s) if (i > 0 && c->is_init_section_common_subtitle) { ret = copy_init_section(rep, c->subtitles[0]); if (ret < 0) - goto fail; + return ret; } ret = open_demux_for_component(s, rep); if (ret) - goto fail; + return ret; rep->stream_index = stream_index; ++stream_index; } - if (!stream_index) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (!stream_index) + return AVERROR_INVALIDDATA; /* Create a program */ program = av_new_program(s, 0); - if (!program) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!program) + return AVERROR(ENOMEM); for (i = 0; i < c->n_videos; i++) { rep = c->videos[i]; @@ -2165,9 +2159,6 @@ static int dash_read_header(AVFormatContext *s) } return 0; -fail: - dash_close(s); - return ret; } static void recheck_discard_flags(AVFormatContext *s, struct representation **p, int n) @@ -2402,6 +2393,7 @@ const AVInputFormat ff_dash_demuxer = { .long_name = NULL_IF_CONFIG_SMALL("Dynamic Adaptive Streaming over HTTP"), .priv_class = &dash_class, .priv_data_size = sizeof(DASHContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = dash_probe, .read_header = dash_read_header, .read_packet = dash_read_packet, From patchwork Tue Jun 15 23:32:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28326 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4311238iol; Tue, 15 Jun 2021 16:34:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwxsQfCNokkyLoBhzFCeUQzr+fbxpDwDZ43f0V9SkRFYSfDVuh2DoJya6+K1+nr9suoTrk X-Received: by 2002:aa7:dc42:: with SMTP id g2mr698291edu.362.1623800090590; Tue, 15 Jun 2021 16:34:50 -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 s17si457672ejq.18.2021.06.15.16.34.50; Tue, 15 Jun 2021 16:34:50 -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=HF1hyZwG; 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 0054368998C; Wed, 16 Jun 2021 02:33:25 +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-am6eur05olkn2079.outbound.protection.outlook.com [40.92.91.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 470B668980E for ; Wed, 16 Jun 2021 02:33:21 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hGbcLMOnhXSh1kyW/0HyzvCjIDItpO2O24Gvf0/XzeRzHlUp2QDMFA99wYXeQ02ZTTtPjcDSlF1X2nhj2sWc7MVkYR0ws/0e9NlOjEHjozk3lMaFZ7JB+k72zquGMnptnfgtd45sf0sJe1zzNWmRppSCxpR8kBlVF2k13tpZPf7camyupMkN4o7CmX2Zw+AqpiBRk5rogTWAyMHsrMNJGpBkWIoENjGHp0ng9RO/vAV4PXIoshISWujUYAEetBwdGJQ+kjXK3LT4d5DqWSh0QTyHPRcRmS+BbU/uby0jiPMx+9K9gytSLHH9KYBSqflhVI9ekhB4O6LhR51689J3HQ== 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=KzZjNJCJVVrGBD1oeAdDPZ4yxjVr9TxijRioMXjFmmU=; b=fIaoxEYhss6VuxJ7vawhdrbe7M8XqlBRnfp+dODx7FTDWjBSbe+ZCEljcQ7aLFzs4a8QtzHslFC2Dm+7Tyb2WDUbUU4XSbIKAv2Osy/1S7EMTcRurJocIywEqjIdJr7zYGa/58MlLYuE40HaL90tuwXQywbpPos9u2dGeNS8GjOF3wfIs5ENCFz9k11BPZjCIsx9pNi5XrqmIWcl2PKPGUAeICZS7+s8SaiyrhK9Tv5UxyeiU7Fs2KJNVbrkrro2PO4F+XpjQT5wv15gWpI2fT9ioKz1g3uz/l6BoiAwlE1mNh3lgjXSlUQL4k7Eml7yDfGlHw+mxqQu0+8hNtANLw== 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=KzZjNJCJVVrGBD1oeAdDPZ4yxjVr9TxijRioMXjFmmU=; b=HF1hyZwG4NJ5OgU3dFqc1TGpPmP4bJ2zIiyJUXj9VrTWeGBvR09p6CTx2fa2mQkYfwLWHDlJqtCA5YNnErrx4XFTwtFtg+ePCADvi8l/BIWUeoHfHnsoNa5HyMkVqMyL9xGCJ4G8WibcL/WzBv9ej0KM9ZAgOgkSG7Q0PVRW+YbPs7nsysTSnPGdqCNiggUWjj4EvrYkqH0LWKWecBXTF6Xh7dtdRWPUE60eNyDtHBf1oynOnG7smpTZeXeXXIAK0B5spZ73U9qdT53xYV8LqKTAG/FYw5sxs3g4womTtxOXoHN11uE3vl2cbP223GBMfePwpeltlHMepUvdPPPtcQ== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::42) by DB8EUR05HT170.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::343) 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:20 +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:20 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:CA07B3D6E808694CFF117D605D2263DEB813996FCD874A26994FA196FC85EC57; UpperCasedChecksum:54D2AADF80F30DF628A283B82E9AF342D4A5E3715C95A4BEC33D23CB9034333E; SizeAsReceived:7590; 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:20 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:03 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [tEC2V1+ZlvP0URYXumQ8OMZAMg2Z29Jm] 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-13-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:20 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 250cc1e7-4af5-4aae-54ba-08d93055f5e9 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pWhkGqqrkWQINYQnacuBy6B8ycd1vy7q146KZHJToK0EVwQslUVM/Dm7HMtAfS8GXEQWrRuD3b67UEY8+Rl/CxYvI3PPcUSZGKchIK0VzwHrzeFqogXXDRoPdj3u+l3H1Ra7KRt68C6nMwt1DeVlP2ZAStzgkDOdqEAVML2es1L4U5ewcKmbsKph5c76DpyomzDE2f2v6jvKdhMSuqHwMvwq79HSn5Qn33DdWZa43woSeXmeT4gTF1z46HEj+ui9V6ngT+bG+Qht9L85B4FZ6QSW4UaeRtaBsD3pwMoCDuWCVCHKTMJLMbYHGMd1Hyd4H8/Pxeu66ax4k+DdvTF52zlsyMe8dCoL/enc+nFqC3xMP4T6rSFgaCCknI0MkExEFst1ZtMtB5/6amfywxmpbqUtGfnaj8c3xNGfbzul2b+8gIGpJxB7o1GjnEo7yTtrYPwLW5PsUb4lpviQWarQ9ojYrZ8+4Y38BqAgOQD63guWYig3x2QS8rWRt1kdPRiqjpbzoh538aJnMAJe+IKeiouNHbTb+Z3IZt2qt16LzN0PD70VXYja1ez633sNC65H/PQhm+mj6Ic2bsMYmQtThM+o5TYeg0SYuSD0SX/dC8/g079r6U6Re9PyhYuuzxDCa+LMn8U4RsShDhbVB88QydyXrfaiebQuU1VjPgd/jguoRZmVHWBt6lXSh5csxMgD9IBRoQJCyKW4ZZeDG8rf23hxW01njkE9SNBoIDxJpcXc= X-MS-TrafficTypeDiagnostic: DB8EUR05HT170: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8ErrXXcQDrwQv4MiP5BjBcQbnf8Z72OT3aKxaF97rtHW4ieFIx8NQPAvwi+pgisMOGvD+WhzhrhOKnVRG/j41EkohCNFLaxN4iiW0oR2jGmzUGLtfjSIOgF7TcNKIwHOletDgbiQpoOxLt7n4r5zAE7mRj4vC1Op4krGTX3qNGXNvdJ+fEXL1TEmPXHhtBWfQCEhL7sPmSHiKVhu/TRqQOmVH6q6Gt6anbsWEPq4EMMkdfOz9JDrMmbFbGnJXKIyOWrqjtLjGxm7iXyaTwClII7Z4fCW7T3d3zidZQsLNVFPGNEpw7fUgLzuQA7oHb/KpgCD0Xo9/RWPJ2MJEvMd6rS/n9VZQpjS81B462/I43xdO2V/OqJ/wOPuH3vNY7fhqdLFjBUMaty0evEwBRtB2w== X-MS-Exchange-AntiSpam-MessageData: oz/WX095R7mWpwO8dPLbukB6OndgSjRbjaQ9CUcB/qoBp8SMVz5pzInm/5J3i+rDJN27Gzw4PxZn0QZFqknoSiGOViMA7NuX/nBVtOxfcE9XZLe6TwZVMiAfRXpIb5r1AtRyDD+MfpM8SurgVD70OA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 250cc1e7-4af5-4aae-54ba-08d93055f5e9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:20.8077 (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: DB8EUR05HT170 Subject: [FFmpeg-devel] [PATCH 14/54] avformat/hls: 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: Aisn+Qqfy5mt by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/hls.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index c2ca23e973..3c1b80f60c 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1874,7 +1874,7 @@ static int hls_read_header(AVFormatContext *s) c->cur_timestamp = AV_NOPTS_VALUE; if ((ret = save_avio_options(s)) < 0) - goto fail; + return ret; /* XXX: Some HLS servers don't like being sent the range header, in this case, need to setting http_seekable = 0 to disable @@ -1882,12 +1882,11 @@ static int hls_read_header(AVFormatContext *s) av_dict_set_int(&c->avio_opts, "seekable", c->http_seekable, 0); if ((ret = parse_playlist(c, s->url, NULL, s->pb)) < 0) - goto fail; + return ret; if (c->n_variants == 0) { av_log(s, AV_LOG_WARNING, "Empty playlist\n"); - ret = AVERROR_EOF; - goto fail; + return AVERROR_EOF; } /* If the playlist only contained playlists (Master Playlist), * parse each individual playlist. */ @@ -1900,7 +1899,7 @@ static int hls_read_header(AVFormatContext *s) pls->broken = 1; if (c->n_playlists > 1) continue; - goto fail; + return ret; } } } @@ -1940,7 +1939,7 @@ static int hls_read_header(AVFormatContext *s) program = av_new_program(s, i); if (!program) - goto fail; + return AVERROR(ENOMEM); av_dict_set_int(&program->metadata, "variant_bitrate", v->bandwidth, 0); } @@ -1962,10 +1961,8 @@ static int hls_read_header(AVFormatContext *s) char *url; AVDictionary *seg_format_opts = NULL; - if (!(pls->ctx = avformat_alloc_context())) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!(pls->ctx = avformat_alloc_context())) + return AVERROR(ENOMEM); if (pls->n_segments == 0) continue; @@ -1988,10 +1985,9 @@ static int hls_read_header(AVFormatContext *s) pls->read_buffer = av_malloc(INITIAL_BUFFER_SIZE); if (!pls->read_buffer){ - ret = AVERROR(ENOMEM); avformat_free_context(pls->ctx); pls->ctx = NULL; - goto fail; + return AVERROR(ENOMEM); } ffio_init_context(&pls->pb, pls->read_buffer, INITIAL_BUFFER_SIZE, 0, pls, read_data, NULL, NULL); @@ -2009,7 +2005,7 @@ static int hls_read_header(AVFormatContext *s) avformat_free_context(pls->ctx); pls->ctx = NULL; av_free(url); - goto fail; + return ret; } av_free(url); pls->ctx->pb = &pls->pb; @@ -2017,14 +2013,14 @@ static int hls_read_header(AVFormatContext *s) pls->ctx->flags |= s->flags & ~AVFMT_FLAG_CUSTOM_IO; if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0) - goto fail; + return ret; av_dict_copy(&seg_format_opts, c->seg_format_opts, 0); ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, &seg_format_opts); av_dict_free(&seg_format_opts); if (ret < 0) - goto fail; + return ret; if (pls->id3_deferred_extra && pls->ctx->nb_streams == 1) { ff_id3v2_parse_apic(pls->ctx, pls->id3_deferred_extra); @@ -2045,7 +2041,7 @@ static int hls_read_header(AVFormatContext *s) if (pls->is_id3_timestamped || (pls->n_renditions > 0 && pls->renditions[0]->type == AVMEDIA_TYPE_AUDIO)) { ret = avformat_find_stream_info(pls->ctx, NULL); if (ret < 0) - goto fail; + return ret; } pls->has_noheader_flag = !!(pls->ctx->ctx_flags & AVFMTCTX_NOHEADER); @@ -2053,7 +2049,7 @@ static int hls_read_header(AVFormatContext *s) /* Create new AVStreams for each stream in this playlist */ ret = update_streams_from_subdemuxer(s, pls); if (ret < 0) - goto fail; + return ret; /* * Copy any metadata from playlist to main streams, but do not set @@ -2070,9 +2066,6 @@ static int hls_read_header(AVFormatContext *s) update_noheader_flag(s); return 0; -fail: - hls_close(s); - return ret; } static int recheck_discard_flags(AVFormatContext *s, int first) @@ -2426,6 +2419,7 @@ const AVInputFormat ff_hls_demuxer = { .priv_class = &hls_class, .priv_data_size = sizeof(HLSContext), .flags = AVFMT_NOGENSEARCH | AVFMT_TS_DISCONT, + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = hls_probe, .read_header = hls_read_header, .read_packet = hls_read_packet, From patchwork Tue Jun 15 23:32:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28330 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4311351iol; Tue, 15 Jun 2021 16:35:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCyfgyft6A3EYGdsSMRkTqpWdGqaEL6EdwgsQiWaU4JWpaxbM64ulTqLdJDLz95RbeIIp9 X-Received: by 2002:a17:906:7946:: with SMTP id l6mr2066840ejo.50.1623800102373; Tue, 15 Jun 2021 16:35:02 -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 c7si365407ejc.291.2021.06.15.16.35.02; Tue, 15 Jun 2021 16:35:02 -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=QTeJA5uv; 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 10F58689A02; Wed, 16 Jun 2021 02:33:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2079.outbound.protection.outlook.com [40.92.90.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 60BFE689965 for ; Wed, 16 Jun 2021 02:33:23 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DdL1taU8kESR0uirKGQC1x4R/tweJuyxNqjF7uDsDJtp/YlsRAwA3uFouu/ujwSplqPy3+AQ9+J/1s0vj+Fyu6qeIdOgjvx5PZHgHfVcmAI0j0jSouhmS3m/OGTOz+QkqIq3jcvrR5zr3tVUNa41q1pZOd95QmhezsxSIeVusiohfpo0LP1yrAGnSElUhMYjzAf2RtrPjBYk1P9fZRmqxznbm29phdYg/3R8CXjS/d+h6rGOR/Sjl/YY/HgC/gJuMvYj3xLheVR8pP66ORXHf29jdYu7q53YY/8MHOvb43twUs/eaDxrkjVNF0FQNAdYlmXTYaZsPGFvnjOq1OG3VQ== 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=oDB0HnfqPY5xl2eNOltva+plE9k/GYeaL1EsorWquvk=; b=J2AfFdBtibu5yoI0Uqzf4chrmg0SjTXcZ4uUm30NZAEXJyI/NtMohm/5oIucmqCFZ4vyOAotyBmf2XdK7oulUprmEUSBjmBtgEyvTKmuUXhgcmHjSCo3dUeYocyEKrDiPhbQ3tD8dkbV+ZE/jp3O7KLvP2u0wKJKFnLwOtoGnuY2Rsp9BzNrHleeVQ7M4/YoYQAbiZkdODipbY3imHKXpw3rufvMGCTlyVeSs3VVGZ6ZpT5IA+2ErgKJ7P9WEhmCnLQ3T31ahQSX3+0cWqKVfmBhEn9KhgZWrYdOxm9N4hvofZgnCWA3rQRwOB4XL9u1KAFRvBUBPPplV/05uSkJxA== 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=oDB0HnfqPY5xl2eNOltva+plE9k/GYeaL1EsorWquvk=; b=QTeJA5uv00kSFmYcMzrKBvI4NCKIQsIoJcnI4Q0svL/mfSbpI1G5IfCp7Ky2uBJFAQa45BZYEAOCaYCR+2L5GgAsqDI5eiyPbGvAWyE9x26N3kWActe6PxyH+fo94XHtBp5BGAOHHWBR+10RspV6tztdFNjBvDqxUUQq6JZlRIoFOlcoHYyWXTQskN4WB9BvagEZjGkgQObBttD8RjmNG+/EQUzjoq+Wa3gnvahsuJ7YlYR8golWR/fauFRerpv2N39/bqwJEEjLb85c5O1nU+BDgL7hX1S6fGe4ukxA8CtGglJ16bspr+CnC/h2om3fsj6HE/xbsgJZNMDoqitgTQ== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::41) by DB8EUR05HT100.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::330) 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:22 +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:22 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:CCDED265DE4822C5BD5279324B9989BE9A29EFFAD2E67199762B5032F00D09CC; UpperCasedChecksum:1FD456D47E9A817F7D1001607F2CF2C07D7F96E6D828A9F7BD1674F3CFD73D46; SizeAsReceived:7594; 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:22 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:04 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [fLtbN7cOq0pZbjqhsSNDQxll/cfn+v6M] 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-14-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:21 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: b7ec3131-c6da-4fab-d4df-08d93055f695 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pWhkGqqrkWQINYQnacuBy6J/a1rG29L1DMSaR+Hl4t8Uhe7SyKIHrqv5axrQyR+ggmjh30kXioPyAVKCRoVRF9A/z5H+B0KfTF3uyGHHpqWLLCm4am26olAHP4dYCJHgBKWFJ0zGq1pCDi7p2f+Dg2WcdG3CCXraD9tCz6q3i0irYSytnb4DvGp8cFDxwcgIGI7qPNRUevShOP+i2Qdk1/LjmaivwBfi2sgcb2hxXrfVcAKXHwhJhIGYDXb0MMcj9Igir4yEJU4fDNzP1aKycNoPIA0AbD7cBYYK5OTgDTEwEPe3l+ieiCXNfv7tpdfAk0WS0lN84d5+LSZ2woykjacEzR6siRWz8ZE9klwRi9W0VyaLgKrsfraSENhmXUHeYPaNS8QLk1QwJ2LJ2X7Jt7rN8tx1PffrrsUU9aC/Ll0VeLtcYPEaYJz3KHJyqwfnug98jr4FxDqW4RoVrrqh9HkpCwQ6CifyS1MSYGo0WG6ajbLVCu51tSOhuch1TVWrQWaAFfU1KX58Ob5Tjx0vjLmeP8U05L+BqUltBZRxneZeih7h6BNgM3pZlSrheuMXgjUsP2bKxf1CnGKVCF7Peurn8v7SZEzzWvyY3nuClvwt274VyhtKo1zc8+At6H6B8lEvZrx2qSxbSwpS8hTzcA6sBODSCQ/IimAtrQ9MNazSdYO4dIKg0H7kZHgF2T+b8scRg42OFislan8KpUiyHWH2QfcYhHqGILZLYddsxkQI= X-MS-TrafficTypeDiagnostic: DB8EUR05HT100: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7ToFb/X9ppEgye+fkWRd8PRx+UCJJ5WhudPX4cVoVdIwWVg59+fSihjDr4lDw+J854Tzp1IJJWbaPlwi1VEH1tmCrSKa0UEoWUhASO6Tt5KuGTxJQuYzRBxt9vwRGIjDg/qgNYYa2I9M2S+3LjRg3bqt8Pgnx9QfCByMiz75EHSQsMLFXP2QNPvCSSQDuDseQn0lSHYL+Rnq3f4gROWrkcaiBCxh9mzGQjffjn0xCMrhaSBQXiisADwLfvD5gz3cgq6+9JUkbtpxGGIoh5iWKc1JD76RNmnihxxEeScGOjl/7xbGnnTFPQU14x0OfXQaOji3hq3vFtG0K0xFXcKCaq7d6vPf+44vsQzo+CIf56A51iuYxW0Q+kziNxuWMg0KyyfF61UoUQ0e0d9Hunr0eQ== X-MS-Exchange-AntiSpam-MessageData: NsNVsIx8Ic7XHqLShSzFCGWZpJEPIJsJxueodlMuF9P1fMFwxuv4Ahg8/ZT5aciKdyTFI0R9MgNsIOkCo7Kfv96AhnSmXSI7raTUwHlt5aqw59jk3LRw4s5JnOlIJEV+vedgZq59tioH2ZHUNx9PFg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7ec3131-c6da-4fab-d4df-08d93055f695 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:21.9362 (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: DB8EUR05HT100 Subject: [FFmpeg-devel] [PATCH 15/54] avformat/icodec: 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: 4JHiLOO1ac2D by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/icodec.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/libavformat/icodec.c b/libavformat/icodec.c index 9349582ffc..2e677c78f1 100644 --- a/libavformat/icodec.c +++ b/libavformat/icodec.c @@ -96,13 +96,11 @@ static int read_header(AVFormatContext *s) int tmp; if (avio_seek(pb, 6 + i * 16, SEEK_SET) < 0) - goto fail; + return AVERROR_INVALIDDATA; st = avformat_new_stream(s, NULL); - if (!st) { - av_freep(&ico->images); + if (!st) return AVERROR(ENOMEM); - } st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->width = avio_r8(pb); @@ -116,12 +114,12 @@ static int read_header(AVFormatContext *s) ico->images[i].size = avio_rl32(pb); if (ico->images[i].size <= 0) { av_log(s, AV_LOG_ERROR, "Invalid image size %d\n", ico->images[i].size); - goto fail; + return AVERROR_INVALIDDATA; } ico->images[i].offset = avio_rl32(pb); if (avio_seek(pb, ico->images[i].offset, SEEK_SET) < 0) - goto fail; + return AVERROR_INVALIDDATA; codec = avio_rl32(pb); switch (codec) { @@ -131,9 +129,8 @@ static int read_header(AVFormatContext *s) st->codecpar->height = 0; break; case 40: - if (ico->images[i].size < 40) { - goto fail; - } + if (ico->images[i].size < 40) + return AVERROR_INVALIDDATA; st->codecpar->codec_id = AV_CODEC_ID_BMP; tmp = avio_rl32(pb); if (tmp) @@ -144,14 +141,11 @@ static int read_header(AVFormatContext *s) break; default: avpriv_request_sample(s, "codec %d", codec); - goto fail; + return AVERROR_INVALIDDATA; } } return 0; -fail: - av_freep(&ico->images); - return AVERROR_INVALIDDATA; } static int read_packet(AVFormatContext *s, AVPacket *pkt) @@ -224,6 +218,7 @@ const AVInputFormat ff_ico_demuxer = { .name = "ico", .long_name = NULL_IF_CONFIG_SMALL("Microsoft Windows ICO"), .priv_data_size = sizeof(IcoDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = probe, .read_header = read_header, .read_packet = read_packet, From patchwork Tue Jun 15 23:32:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28347 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4311441iol; Tue, 15 Jun 2021 16:35:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjjkDvULE8VFE4VhMI+cCsCVeh1+DXGE+v71xaEuZ4CHYFNVDuMc9x5e69RwwJrSDHAusm X-Received: by 2002:a05:6402:2317:: with SMTP id l23mr673329eda.265.1623800112171; Tue, 15 Jun 2021 16:35:12 -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 5si357889ejb.197.2021.06.15.16.35.11; Tue, 15 Jun 2021 16:35:12 -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=rHMlVTwM; 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 B8B73689A6F; Wed, 16 Jun 2021 02:33:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2079.outbound.protection.outlook.com [40.92.90.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F33E9689985 for ; Wed, 16 Jun 2021 02:33:23 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AWlOEHh7D8nDPMOXtN38Tbg/VwYJgl7Q7g6NJ9vWwGxMNn1KW1Ooc42JrNDLoizdDxiCMaiO4OZojv4u+rjEkZS6wd/z2d2F2/bIBdYj7ksVC0gbGo2kLGVDauZ5CNfHCQsRLob7YlO0Inxb6b4vv3x9PCzj4Jbt5A82hfIMw8COtID+exYGRbQ/q2gOdMnUDXecx5g+TQAoZuponJrTLTH/3IB7dlUyg9oZUVG4ikSfgMmZ8IZRe/0TgwCyDvCtwjPuq8F+9sV3dlYm15UX/S3kGeqnytQxIBncjy3XMmMF6PBtTdhXaruLVW6qcXa+/0QI9eQJbGPzPownr6VEfA== 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=XN4d4rF2RI1quroFnrlyDN7MmK4xQMxNyqOllyC0nwQ=; b=eEw/YmdNjmQIrl/hNPKdr9Bcxf4XgMkIKyvvOdPewO2tW8ZzV+4NJ7uvBMVk++bsb8i1nVCHMUnawSsrFlA/MKr7chCzOLBgftAkI2L9MrYWxBI+U0Rwrepadvcn6Pv6HPxGf4qeFb5gIeE+dhoN5IhZyRf23cJvmc5jxLWlcprldh3RIwxnXn/sl0Z6pLVXF1dHtP05X3q75muSY8PUGTeaxxYbfEzjBdxQuzZZmBZ6M7mazU7C1C2OvGP9bvUfvZYxOdUkq4fQniBR4Ju9oSziBa0+ieuBOuHG60CWmP8Wk3ei/QuZgr8Y2aHCEDahhpiSuc+qPQMeHMqINIg5lw== 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=XN4d4rF2RI1quroFnrlyDN7MmK4xQMxNyqOllyC0nwQ=; b=rHMlVTwM5f3Gca4tw65jDXbL4AjvZ1864Tibvwx8jt74p5r2JGTeNey/sgg8zJEmVQ1SE237oZzmil3C/WFnnCLp9UbX8yi0N/A4sE8eMSk5DlsUt5P+aryEFe7SNJFWoQdlP0W2gztDfR0G2IZxf49HFu4FF+Y+mBGch/Cnqvd+7vaiNXh1LEw3Y2CPto05lb5fxE8t29tLPUoS5fNIguFDp0lrZTxxN+uxcsQNSgMyx0j5cQbH/jcPkk/TCfIlWUuoVHtcjh0utqLkBMpRdn563yRkJpho4NgAPACezMuJPmHdfFZC499EiRcnw6kDUH1dWbZ/Ypg4mstIDb5Y5g== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::46) by DB8EUR05HT135.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::237) 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:23 +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:23 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:1D1D9E4CA08C06620B20EB940735A74E9F277704BC4395DACBC84E0CEB58E29A; UpperCasedChecksum:6BE197FD7DF4EE5CCE4DD6FC568EA9DE4359FB5F3588482264997F30A8BCF4AC; SizeAsReceived:7597; 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:23 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:05 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [8KqlP5MpyY8YRBcceckN/8xWgbqU5VlP] 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-15-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:22 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 006683f5-5084-493f-60f1-08d93055f760 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n4J7adcKN7I1HlOfOuLa0YFlIkuc4XcrjQlwmKSXXqcXGyuQzBGpfFGSg++wMomiiQ13bn26jQGEHyoU9myYPXsvELPGgzdrwBkpWCyNQqHyOwiXOd5YHdHYn1FxN4JDkfa/h6lJgXe+evGhwhDLhjeDXIKRqGYcCGaHb2o5Sw8QSDK7CagIYBVysqjwQqGIEdIiztzCSjdzli4mKWu3AqiDVSueUqcqHRO7D6Bcqr7UKPqe6i8LP6ddHOfSeHmjFXEKSZCHtSeu1ebCAkVko0r3QadQh2AYKtpgN9j/ivzvzgqPNaprXBcA95hhGlrkxJtyfowxarhzzZuNGbXjWpQPubwCJ9cimW1/4Y3PgvF5fFIa+q74ZWgPaJN6amNwzccjbGgjGRfnTdtP7aC8r6aV7DYxovhgYbwZ19Q5SqD0VSl1QKTSvOK8y3WJdYm/aTyoFhQZXS4yJFCYKkGvyV0qbpkW3yU42tC4GP8Po70LptrWMUAP9q8N3P+YCjaKspHHOqa4cTF9jsisK3eP90KkB8hpimnfVoGkQg+Hlq88t55wFNYrPojFurSBME3XHbejgJ032pTmnhTGMIh/QFx+800cQ6pPJAf7QmAPJKq+crXBQkmu78jw5WSIkTMyKQBM7TGpNugbCfEa2chiu5ZxKK62wO4oSgzBH8jX9MlpR54CgTfGtK5x/fcjhmNogSgyDNesIhUB109BM9lh3tu9Qy23hUHLyU= X-MS-TrafficTypeDiagnostic: DB8EUR05HT135: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tRka3Ujrn+cnEF9RlkZnDwlWSFzpsgzvs46PIcIU+85Z6hYQU30/OMkTMY934KfMMF98TKehhFc6w8CaGiBpXLh+YcK2rd4QrrAX+ElfSt0vS0VoBeZ7um4N67lyTqEumX+jctTcHZWhliG0Zjp1lXgPvXrlEOjUxnliMTmAryoCQY8r1C+qsvRPbdoSCB2qli6TlUj+AaANFiOewNXYpzR9Y+JmO/6yjVoWnuIwxzTLzWtB4m3jhvTtvAPHd24L2kdPIBdhJZTAMX/n05TlFQbRgUggJH/cjuUnQSlpjhOFqG/THEEC4S9Jy1HjT0yJPYUmubUBZIcFi3/2w16dLaIHnI5ObNJV/hCSGKMq2y4BNjwxIEvmR4sWBh2zKpEzBxEPZkqUF4zbSLbGuPrzFw== X-MS-Exchange-AntiSpam-MessageData: Ra2FxoT4CDUjJBa6zYUQT0bFH89EnYX5sLb6AtlSe7ITxZDRlPOXnY0Ye6WnpkHFFcHKkpNY7xVUq8PTl1ZxbapvwGqew6vD4zKPayxKr0YwxOV3HMhBuphNDjTGOL1MGnmr7fFZJvEJ/bdLVmFHhw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 006683f5-5084-493f-60f1-08d93055f760 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:23.2516 (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: DB8EUR05HT135 Subject: [FFmpeg-devel] [PATCH 16/54] avformat/jacosubdec: 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: D8RmRBVFEtRR by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/jacosubdec.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c index c8bded02fe..510219224f 100644 --- a/libavformat/jacosubdec.c +++ b/libavformat/jacosubdec.c @@ -200,8 +200,7 @@ static int jacosub_read_header(AVFormatContext *s) sub = ff_subtitles_queue_insert(&jacosub->q, line, len, merge_line); if (!sub) { av_bprint_finalize(&header, NULL); - ret = AVERROR(ENOMEM); - goto fail; + return AVERROR(ENOMEM); } sub->pos = pos; merge_line = len > 1 && !strcmp(&line[len - 2], "\\\n"); @@ -246,7 +245,7 @@ static int jacosub_read_header(AVFormatContext *s) /* general/essential directives in the extradata */ ret = ff_bprint_to_codecpar_extradata(st->codecpar, &header); if (ret < 0) - goto fail; + return ret; /* SHIFT and TIMERES affect the whole script so packet timing can only be * done in a second pass */ @@ -257,9 +256,6 @@ static int jacosub_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &jacosub->q); return 0; -fail: - jacosub_read_close(s); - return ret; } static int jacosub_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -280,6 +276,7 @@ const AVInputFormat ff_jacosub_demuxer = { .name = "jacosub", .long_name = NULL_IF_CONFIG_SMALL("JACOsub subtitle format"), .priv_data_size = sizeof(JACOsubContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = jacosub_probe, .read_header = jacosub_read_header, .read_packet = jacosub_read_packet, From patchwork Tue Jun 15 23:32:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28341 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4311557iol; Tue, 15 Jun 2021 16:35:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyii+b4cE+IQK3T4cdHz9AL7VBxr+0vhr9Dzq/TW/gJjWo9jqtgARFGxBMJMJJUz2HoX/Du X-Received: by 2002:a17:906:7fc5:: with SMTP id r5mr2133547ejs.474.1623800122127; Tue, 15 Jun 2021 16:35: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 v9si269551edc.545.2021.06.15.16.35.21; Tue, 15 Jun 2021 16:35: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="bjBp3P/V"; 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 CDA95689ABD; Wed, 16 Jun 2021 02:33:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2072.outbound.protection.outlook.com [40.92.90.72]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B372968998C for ; Wed, 16 Jun 2021 02:33:25 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NbBzTqWNrWROnspw9oxb/FPEoVzvQlXo9AAa9AqoaPgDwPr9N1mhO+Iw1cvEXf8LLjgaYDdUdC/Au2P4uDjshWfQXHU7t4N+6P7xaE8NXwYaZQpp66hVPrq3LtVqRo6Gw3N/B7/bLUvCvEVrRESvk/gS1BI/IrncmGiweGz6xhs/koFNtrGwftDRDxVhMAef1ne10bSlEWcPI/khUOJkgqAaiDtlctBG+uhheOSalEUq5pJmwLuI11klLJnuuTw6aY6L7MNNovf+CMVE+aSlYb2zGkEIk4LhEiGdbrqCtTRId536XNEkuWxA6pX1X+N77jbbls4uScFB8nt791KvhA== 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=vnd34B45DyWii6l/4KICIplNREGegNfk76A7q80TBuI=; b=S5wWdTtON6enawagAEJKP3nEPpK7np6yDUugHtMgt3CJfe7UusMcrT7ghizWjo3riLb+mRVkYxtsBh5PDDXQp92UKZkCjXQdAyoA3MkJBgTrgALlz2strsG2ivZ4xsZBN1ymFCVRPk/wAi6x5rdf1wXi/9P7I8EansIEU+UfVIlDnRg8NrEDSuqiHpWccBsh3jvvoFHa2EYO9FRCKaCF51P+te6Qx4fQ0QXfodjh4ZeUWiD6jxY9seld8yfGI/GPnDzQ/kUPKme5J3b+tme8qXnHk2sSWp/w/9ol/XrsYw2VJ9I642jPM535XQamgQ7LRJmfQh3IgmLrW0hAPvpwHA== 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=vnd34B45DyWii6l/4KICIplNREGegNfk76A7q80TBuI=; b=bjBp3P/V7p6wSDiHxcW3zTqgaHZJLUsxANItE/UT4hWmKJzfdqgTrbkf/IsevpVff5FI4psSFA2opPE257y6TyDb8XwpXRk8bsSzCeIKwKr+949PtkIwSrAx+qL44o2lyq3IZdf2u+WJdYtZolOs1od62YmR+2v72xgVIIpBe4xYTJnii1jEThRuLaAPAYbLgI4+QSS/9r+16rvs281rKFeu7zAY1ewP1vGm6xt7YyZBo/lvPG3tsEOYlsi7bnB+UBP1Xxtvn5G9KayliWnwPbmTLjSfmoOCExa111hxGm6A+f3WTOc2h5wgerXxMq1pZSAO95KJOdmhFNzGU+1gOw== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4b) by DB8EUR05HT166.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::76) 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:24 +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:24 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:EDCA090571689719500E445EBA4909C4FA283D97FEA716F9F530994E0FA6DB39; UpperCasedChecksum:E98DF2E6C0D85E56DFBF287F8EF377B08450B25346DE3078CDC844130308EDD6; 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:24 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:06 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [dqSH0eiRk/quoNxcJ3sNpG4Fs9k6SGkk] 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-16-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:23 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: fc103ac5-0eb2-41ac-8f3a-08d93055f7fc X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjMDyua2eyp8bVC8Z6JK7zCP4e2oWJFTMZGh6gKimDncaPJN68NBrm8ereyz8rCFNIqQuPSDYjnCqKInVB4K49x5QUIVDGlV1sDcwvXFL/5cYDEJzEEjOyTAV/0vK7GA22iG7tpBXrquv6+HFoDw/x9gLURZPA/HaefQzK5LFfZ2aKCtvzOyrKg00zZGjtBekfktW6HFw6WqGuPi7BOJOAM+/uPOyD2jamq2ilhH582RHH0dwUrTC1P8Mokm0VX+Hbc7u0xJP+3Ed7MGwGNrvun7jp4q4XLWEPdaTz6g8kd6hXlKOYZlEeZHJtOnn573xrDb77S51Q69prUltgaKBc6in5GHEFzzDp3j9JGdQoJScbjzNTJ00UTxpAgA+LytVEtOl6k2iEwiUa6p2fGntVRSmtxXcZy4mcR+6De7PyIfFVMqVqGFYmq0yDIlkPSlj9hYUTd0i9M4VbofxeX6mLj7Aw2V4w8j8G5hDsP/iXmO7TdYL7pXN7hOO9VgGmLgfBq19Zc8QiJLi+rDf8lgsg2Ga4YimMMbk0ilZfj/PEl9TSFLccnLpuVvHH1R0J/rruuS9zr5gB8jbCa6IHOYAFFtSvjT0+/v1IThbZzFrgxmJCk6HrxBuT00OOqI1czLuCxn1erLVc9WLSHyJz2izcZ+kAxcRD/9TjXpQadDBEu+qSKokiA/eZ5oP2U14yqdJmUiGRJ/mm3zjQ15rL6N+mNo= X-MS-TrafficTypeDiagnostic: DB8EUR05HT166: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9j2u/hJmD1DH2O4EKQf+ItZ8N5kCMuCHhR98YfctV21O7YiNt//4u8pFhS+GsKX83UCHm2UtC2WA1+KzKoAtARu71nUlCtDk+klS+I/i8hxszDDgSN5+YTyz6gVy2P6j28KEENQJc3vSoyYSjQjiU31s9d8Kg//6NOt/OTn++XKD+EW/ERfgGUf5swg9ItE35Sh3mUR5LYTZHZP0AoHmLn174TZQSNbn+CTzGXAlZITT6tlo92eyA8iK5RdqMqVZtjLk5B1t79ho56e8dWMdEg3xPMcj7JuPc2vjUlhsoUP2voMeEZT7S6voISR2TlgvVDz0y6TUfZmv0oTMZ4JmLqaXrY0igis+5RzYqY1R+dQasWf3FYvfoEXCCX+YUCInMSo5va9t0nfEIRU7s/7VrQ== X-MS-Exchange-AntiSpam-MessageData: iST9XMpxi4O3BX2+txA5R7iviB59ld8BhqbHGJfuThIXQn1xFxgrz9K32mInamHXVW833ZNrggRiR2AVBd5y4P/qp8+vd9w9rmW6Yh9/35OY0pUY8hgH4J/HL+RuXZFHuuUQPZ4lf9JOHiEwB4sm6w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc103ac5-0eb2-41ac-8f3a-08d93055f7fc X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:24.2722 (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: DB8EUR05HT166 Subject: [FFmpeg-devel] [PATCH 17/54] avformat/jvdec: 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: zON3u4HZx6Fx by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/jvdec.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index 948cab37e5..a044f50831 100644 --- a/libavformat/jvdec.c +++ b/libavformat/jvdec.c @@ -113,10 +113,8 @@ static int read_header(AVFormatContext *s) return AVERROR(ENOMEM); jv->frames = av_malloc(ast->internal->nb_index_entries * sizeof(JVFrame)); - if (!jv->frames) { - av_freep(&ast->internal->index_entries); + if (!jv->frames) return AVERROR(ENOMEM); - } offset = 0x68 + ast->internal->nb_index_entries * 16; for (i = 0; i < ast->internal->nb_index_entries; i++) { AVIndexEntry *e = ast->internal->index_entries + i; @@ -136,12 +134,8 @@ static int read_header(AVFormatContext *s) e->size - jvf->audio_size - jvf->video_size - jvf->palette_size < 0) { - if (s->error_recognition & AV_EF_EXPLODE) { - read_close(s); - av_freep(&jv->frames); - av_freep(&ast->internal->index_entries); + if (s->error_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; - } jvf->audio_size = jvf->video_size = jvf->palette_size = 0; @@ -258,6 +252,7 @@ const AVInputFormat ff_jv_demuxer = { .name = "jv", .long_name = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV"), .priv_data_size = sizeof(JVDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = read_probe, .read_header = read_header, .read_packet = read_packet, From patchwork Tue Jun 15 23:32:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28343 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4311802iol; Tue, 15 Jun 2021 16:35:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbSWtkf3+iD+c53VQhw0ewzmjK7rbS2r0ezMcKJcH4p6p6moq3Dp2JkMF9ND9gteKbLUeM X-Received: by 2002:a17:906:480a:: with SMTP id w10mr2084854ejq.18.1623800142181; Tue, 15 Jun 2021 16:35:42 -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 bt10si423038ejb.390.2021.06.15.16.35.41; Tue, 15 Jun 2021 16:35:42 -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=pdNRectc; 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 F1261689B7F; Wed, 16 Jun 2021 02:33:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2095.outbound.protection.outlook.com [40.92.90.95]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2D8D6689A12 for ; Wed, 16 Jun 2021 02:33:26 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GFCT19gUeI9uwJCu4OSqDs5FpXgPL0mwcy+zz4EoxzpqxMKq8O47XpliV0hSJt4wwfNdXpQfQl7HoTT11ZoTtyamTHHaYXWVyJqkWZErNbcYXteyG4rgaMR45aPejnHkbo79DG+or2QCtMjTKyEYQHPMd5+WOe27WOddwEnSPQXK+IDf1mMnBU5nYIO8vv+JKDKa1zqJfAFvtKbF2IbIuQHqcMNRfV95N/sBtGp/4qLzGarwCWX8mVXYxmtEhUMFLmijFbLQTqX9Oou3wZRk7T5R48osj6uwGJfH23Zp7j1wL9ogfILvWoWZvluTa6YBd8G/KdqJrK6KZ3SyYpPvGw== 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=K5+J7wUB/sTVC5LHmahdKlTw8TIVsUEAcYWytyIlB7k=; b=Ai9n+XzkaUKyyGertRL1nP8DSBTQ40rNclMqhP5/eJjo9mBdjSCCco6UR44CLuHJyHLiJtoWru83KMgntu7aZzknpIOx29XpCCfUi150skpE6y1UuMuL72P3SoyWbfMgSXbtd9LvF5pS9c7TmeggxC7j70sr+Z/X/ltOD8KuPBviQmBp77JjXpiIpatJCcIAPKavaGQt2w9Hi6I4mj+9hVzVtqJZSIhntGRCgnl+TkL6ux2fwxZh2CkVSntjpmzFErAQ83RDC1uiv3Eb7DkKn0VrM2KEegYkBwool/aeqGIjq1Kap9b0eObkpPJSv+CT5PteaepIwD1jHvwpEkM7mg== 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=K5+J7wUB/sTVC5LHmahdKlTw8TIVsUEAcYWytyIlB7k=; b=pdNRectc3ZZCButwZhp7JNT/GxBhmxlCbPDoqN6JG6GajXPg91NRMd0siQIQBkgKg2Ho0KaZZjkVBSzuEC6B9k8FzfkUYbZQdHDCtNuu5PUITjG8EfKvqurp0RL5TyDGby5zKQ/oxbPoR+ov+p1DN/AQi/MHdJJnuKcFwMRr7h9TmuI/PdQjJv6DMy7LTO8JzCe74Tyt55MSS0ysZ12eAh2eun2L69ee7BhWSNiCb7AmDNs2LNX1PTQGEzDDXT7bC9xrKWzrfSfGSPeDqPEHKRB4zIrR8wYABs+fHlCAXKKJcqONxBEy7zVkdt9I9eF4H7FKD6Nh6ptW3Z6JXyixFA== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::51) by DB8EUR05HT149.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::112) 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:25 +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:25 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:291AB54EC00EFD97200D1615345C47E986A13D799A7B4CA686CAE135C568EF8D; UpperCasedChecksum:94296D7D7DBF0228B6EA206C240D5E475359506F45BA2270680225D0DFCAF5FA; SizeAsReceived:7584; 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:25 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:07 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [6FR1/+MMkyUn4ivNACkhJQfzfhdy/+r/] 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-17-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:24 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: ce36c78c-cf4d-4a5a-7379-08d93055f89f X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjJigjcIXI0Db5zo2BIfQfrEzmuUKuMn/j18CKfRWtm2d9C/j8C0e1yVI3jm8DynQEQ6/MnwpeRmmZfb5J+ojpwdGeASK9BpSU3Fyj2EPoLLti01pgHAl4CPylgAZuIQ0nXhZT5QrgLVJRxrYjcNG6sPgxokZ4H94pLuFpkT+W/bOsXaP/OshuwwzVmVdl1VOE/fioO9ycI3x0+SRnThxrZTij4Rhalrxmo516t/yFKFAiOFrEd1ILw5P4PxDL2JKdjpUlYVBpb0PoINgu7uF7M65V8bbXo5qL5kK5sBsUyf7avnuDxLP0XP6iQYBwGym7cBKaE9T8y04u/mcvMOcOsKYwNgXIs8mdAumwWOKzQYpEzOh/Vw4XFF3McIN4wUA/24ltk+rm2oGLH/WENBbeqgH3GFUeFIO7JQUys77oDaPz2d+UYmRM7q1pcGuMDWx9IFnwWqYzK22wsaaUvK8jMgg7wBqtt4R9G0GVdm1XcwWqnQ0EdqrJ0yT58bnQko9LvTZzBo+3NdlzVjFn8eTivdMFcborKmEcBzPkdjg/qHgjC1+6JsXqmKXomy2nZjLL7zBIpNbGPE4NQRxtPyfaIP1lr2SfaqPKbIPV/UWbOeZoiSVGp4+xyzneV+qH3EfvbVP43GbAJZRZKbp7NNOfOaHoVOUSJKsBkmR4Fuu7Pp7MLP1iDPEMNlv/Q+qpLWlHLlI3QD/J+jM4Flg3kpewwk= X-MS-TrafficTypeDiagnostic: DB8EUR05HT149: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TPNr8N3nji9vi1q58j/DC7lierjlT5567C+5xkLDYtQSA7dKyj/4h71hMGVQK7LMHhDMMLbJfFPycIIs8eKMUyHcQGfj+mpVCRurvhNF/SGeG6018QMQwbdLhf8KuVFtbE9ODTAyw35EjJxV4PqEhw0u4nOvAi4x9P5iKFt4gNPvNFNgLGvnVsmZGnXZgxyx7tFPpLXzSXqx8/YyQbqrZJHmbU0dcxu811tPKzx/PagwIeZ5A7aPSL6SJqPstHJO4chVtTa48p8SokTWPCfufYE3BTf+2xHZ/+sEOxyjz1vpsARQ7Ojl6paDFEUSvpM1DTis/sxaLoUvry0X0FIl35sjx5l/kGVDEQjE6rgNK9F0qrtXGRkLuc3Reo8x7hFFHcTbzjQzl/ESKK/OjFE0ng== X-MS-Exchange-AntiSpam-MessageData: 9SE3Tk9UX18NidzUyaKVXBnK5SgQ4CkGEohLrw207RwIVsY37LVvYnH7hz6W4W+3WMkXaRUQ7peHsDYu1/a1FDBTdEHojA93b/K2QPrWoroekPCa3EujT0c+2zPWT9sZ25qeyg0ngVvLXgN4K+/rbQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce36c78c-cf4d-4a5a-7379-08d93055f89f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:25.3617 (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: DB8EUR05HT149 Subject: [FFmpeg-devel] [PATCH 18/54] avformat/libgme: 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: c4pDqM4Vu012 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/libgme.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/libavformat/libgme.c b/libavformat/libgme.c index 95323002e6..6a145349a7 100644 --- a/libavformat/libgme.c +++ b/libavformat/libgme.c @@ -84,7 +84,8 @@ static int load_metadata(AVFormatContext *s, int64_t *duration) static int read_close_gme(AVFormatContext *s) { GMEContext *gme = s->priv_data; - gme_delete(gme->music_emu); + if (gme->music_emu) + gme_delete(gme->music_emu); return 0; } @@ -121,26 +122,21 @@ static int read_header_gme(AVFormatContext *s) } if (gme_open_data(buf, sz, &gme->music_emu, gme->sample_rate)) { + gme->music_emu = NULL; /* Just for safety */ av_freep(&buf); return AVERROR_INVALIDDATA; } av_freep(&buf); ret = load_metadata(s, &duration); - if (ret < 0) { - read_close_gme(s); + if (ret < 0) return ret; - } - if (gme_start_track(gme->music_emu, gme->track_index)) { - read_close_gme(s); + if (gme_start_track(gme->music_emu, gme->track_index)) return AVERROR_UNKNOWN; - } st = avformat_new_stream(s, NULL); - if (!st) { - read_close_gme(s); + if (!st) return AVERROR(ENOMEM); - } avpriv_set_pts_info(st, 64, 1, 1000); if (duration > 0) st->duration = duration; @@ -201,6 +197,7 @@ const AVInputFormat ff_libgme_demuxer = { .name = "libgme", .long_name = NULL_IF_CONFIG_SMALL("Game Music Emu demuxer"), .priv_data_size = sizeof(GMEContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = probe_gme, .read_header = read_header_gme, .read_packet = read_packet_gme, From patchwork Tue Jun 15 23:32:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28339 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4311889iol; Tue, 15 Jun 2021 16:35:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVjXPs4Mqja/40/szWVA7WAKfULRi7iVbZuSpy/41RZTQf1b8i4tBT3QWXRu76x001Cq01 X-Received: by 2002:a17:906:ae91:: with SMTP id md17mr2093360ejb.433.1623800150848; Tue, 15 Jun 2021 16:35:50 -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 22si431146ejc.357.2021.06.15.16.35.50; Tue, 15 Jun 2021 16:35:50 -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=sGfYoPCF; 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 CB3E6689767; Wed, 16 Jun 2021 02:33:33 +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-am6eur05olkn2056.outbound.protection.outlook.com [40.92.91.56]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E3FA2689AEE for ; Wed, 16 Jun 2021 02:33:28 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NLilWJgNOsee2x+Btaq2jBILgWeYZ1VZ1dsPzMeKljkcSwcgJe1KeHR0WYg8HaRHAVUf7YxDbrUa3LRy7zRwSNqrLwDXaRfYejjBsBB/MpXGyUjgeIkLrHFyC/d0GCEs1nXFb4eiFtmOQEcor3ckbGdHrCjC2gpMJO4xvukEks5kWzLj4prcE6fDWUJJ2hAr2/aqzVaZSwXi4fsybY4l8qtqgbNvEttyLe/yRzoMBAMshUP1B+jDtpk3sX4PahAyDYI5bDfJD6tW77HQYaEeR67z5jo+OEWRozhe0bskhu7QCdVUN/xAWSUximkiPxwCFrVg/OPWHh4q/OiKDx332Q== 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=QDHURk0odEg4tObIhxfHDkphCH70UkuLb8tfZ6iqRAQ=; b=c1Kwe8/MNILpGn8yIuqdtdS5nJLQon+v38tv5zPgdbPn1mPCF/wnlCBvh9qvTpPXv3ZTBUnwln0fWrj+WuIaoSBgMrWGI0ajMYSaZ50+OtWoFUJT2tmrGr0ogneoUau7bf6S/Ih20eSufSvA6AnRob0y2kQC3I+W/fXsFISdlPzqU5xFv5EwUTvKhzuFZ5D0JXpl379t5VdgMovD7fYRPNGCiLPwTlc9N4tExyHxKaFJZD2gtBKpsd6AMtuaSNujb4qMuCpcaUW0smWIg0mcm6QuAEY0uCQDqHaD/JXf0bzoMNQclIR/OtDhJYrdPOba01R4nPtyYfI2aeo09eIhpA== 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=QDHURk0odEg4tObIhxfHDkphCH70UkuLb8tfZ6iqRAQ=; b=sGfYoPCF93MijDiMbGEU+Ya8TMrzmlyRNKn1i6ndIzScNHJXE6L2kLo5t4Lc1Tequ7d0q4Xjjz/YiSt7Gz07VtZp0D/jB5tknYQ5tot25dmfGcraRu44FYPdCXZu284nocCDYqaCTfspQF1M4/0NQNwz2UP99LSfxIHuEUVcr0tclbYJTtxktBnNlApzNOdsASj7DopS+paY4GVQdofvO9iP1fApTrSc//hxjkGCZAciKdVNvZgSrQRRXk/f1hBx3q8PWrs6poU11YdPpp29ioxQcoS1KtqSe8v5oThn86qD67j+8RBt0L1wCncxhOXi0fCziWj5tmzwsn5GYA7dbQ== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::41) by DB8EUR05HT088.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::262) 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:27 +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:27 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:5506B6750E4A7FF74DD344380451F2AC502022864238E44C85A3F40400BCEAFF; UpperCasedChecksum:2650B0C7DF8DAE4A8731EF574F91F7CFAE1B28C5F9901E0FCC825CCB2C123FCD; SizeAsReceived:7597; 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:26 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:08 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [xGXnuRBnEs9ZJ3k4k5gIyUI3iP0oyLTl] 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-18-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:26 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 084f2d80-415b-4453-ecdf-08d93055f98c X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4p0OETr0+Jrn2aW1jxIgMYUaGUrMMeTGJmcYcFJvvtQSHyahcAoKfp+NbSXk2FuJELr7wTxNCKG9xeILM76/04uQjHNpnpq3LygCKQakb2LizJ1h39QOrXVeBO/4md90Gg7a6IxycKZ3r2qBV4XXHtVMtO7XD56gHKGyhcyMXuucmmFxjR2WnCIVdDpLdGQkYj7BRnZFACpVxK282DDQ77UuyMSxDnEm3/SUJ0J9j+WFsfcCfv9o1yJ/IyUNdzlj14JkyKqNRc/i3hwpt8yseHT+5wAnypgFzkaf34b5WDqzg+E7RfO8Vfsxk4yl+2nvIDNZmdhcJF5XVJTSwdNeR4Bwf6EQHR0c+rfHOHsYEyjyJ7H/bD3R9nzEMU8UzYAvG2o3CqJo7AfftnAA7CIffraTmGtRjZie9NxelQjASoptdsWuS6Oc5vpXtc/GX0/szJIbsCIMOr1mxChtrdQ5QCNH0l9nB34qCIcY121OzlUnUIx2tejkdUZj4VIT8Jz8PPqLHsbSbPJsllBc4lvSGpNChTUWstlBmtivCG82eLhw4vcrBQubfyBH+ABEzxn0/G4uvCMs7gLwcdgrz5EXzoi0ebPAGELO8FIuTZ/A376bpAHaOUJaqWt2Jp8E+v8+Nw1rq7PImE+UKcGsk5avnvZkVZhSnCmGL1c8Tf6icsnRijclnUBAucRYFrwMXQlBmVMRnaSs0PZxw9Leh+LpRr4SRLbN6UoUhizLTG6wF+PE4= X-MS-TrafficTypeDiagnostic: DB8EUR05HT088: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZQBfIz+wJEXdgmakzhjYYnxAe/Kkk9vVv5XbLPE/N8VTKKOcJNhAeow/pYV6y1GZo/OcWky4JIL/XSpSywutTwQ36erbporRqRFp/eIJk6klI6+Zn4559xvYNqeVQ3/fAO+jwQmE/1zaKQr09qQhd4qVJlzDcW6FRqYAcuiGtQHOoUH1hRtvRdsElHc4ANBCels+9Bn7HpMS3UuexmRcrL3mE0OtjeaTOLPmkagfaMLVt0w9g0VBni4s9cwgz3Gnqmt+/lH4DNJ361Fo7wVigP6TzmkG/NKHbZyJM62EWqcGqT4yS09YfC3UpNkChhwOXdGCgPObeoN/udsOXBTOoc2gBA/tBt6V+uNV5BkJhMqEsIPSkYShSpKcdPNO+kKcMsCuOfCR8sop84f+Nb0RmA== X-MS-Exchange-AntiSpam-MessageData: 1SyFCrVdQIg7mKfaveDcY/+Je8Eg7LAIHAoL3/36UlnkSGZeb31lo5O2QWPm41QMa9qNWC0gBPL6mYc0odCv+DJ0I+wxHXq81+r4zVQGHrcj34zcOcX5jBByGV7g6QfbsPaGGJfVsmqwUndt7EiJHw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 084f2d80-415b-4453-ecdf-08d93055f98c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:26.8930 (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: DB8EUR05HT088 Subject: [FFmpeg-devel] [PATCH 19/54] avformat/libopenmpt: 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: cv32nu40UED9 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/libopenmpt.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c index 628b0939dc..d04aec5471 100644 --- a/libavformat/libopenmpt.c +++ b/libavformat/libopenmpt.c @@ -122,7 +122,6 @@ static int read_header_openmpt(AVFormatContext *s) openmpt->channels = av_get_channel_layout_nb_channels(openmpt->layout); if (openmpt->subsong >= openmpt_module_get_num_subsongs(openmpt->module)) { - openmpt_module_destroy(openmpt->module); av_log(s, AV_LOG_ERROR, "Invalid subsong index: %d\n", openmpt->subsong); return AVERROR(EINVAL); } @@ -133,7 +132,6 @@ static int read_header_openmpt(AVFormatContext *s) } ret = openmpt_module_select_subsong(openmpt->module, openmpt->subsong); if (!ret){ - openmpt_module_destroy(openmpt->module); av_log(s, AV_LOG_ERROR, "Could not select requested subsong: %d", openmpt->subsong); return AVERROR(EINVAL); } @@ -148,11 +146,8 @@ static int read_header_openmpt(AVFormatContext *s) add_meta(s, "date", openmpt_module_get_metadata(openmpt->module, "date")); st = avformat_new_stream(s, NULL); - if (!st) { - openmpt_module_destroy(openmpt->module); - openmpt->module = NULL; + if (!st) return AVERROR(ENOMEM); - } avpriv_set_pts_info(st, 64, 1, AV_TIME_BASE); st->duration = llrint(openmpt->duration*AV_TIME_BASE); @@ -206,8 +201,10 @@ static int read_packet_openmpt(AVFormatContext *s, AVPacket *pkt) static int read_close_openmpt(AVFormatContext *s) { OpenMPTContext *openmpt = s->priv_data; - openmpt_module_destroy(openmpt->module); - openmpt->module = NULL; + if (openmpt->module) { + openmpt_module_destroy(openmpt->module); + openmpt->module = NULL; + } return 0; } @@ -285,6 +282,7 @@ const AVInputFormat ff_libopenmpt_demuxer = { .name = "libopenmpt", .long_name = NULL_IF_CONFIG_SMALL("Tracker formats (libopenmpt)"), .priv_data_size = sizeof(OpenMPTContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = read_probe_openmpt, .read_header = read_header_openmpt, .read_packet = read_packet_openmpt, From patchwork Tue Jun 15 23:32:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28327 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4311996iol; Tue, 15 Jun 2021 16:36:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLyg8s4zW4iuoXs0inSS9MdelXR12BEzjjRt2gcflXicCZFACoqx80smfF8MioMo0kLkhW X-Received: by 2002:a17:906:2419:: with SMTP id z25mr2006946eja.343.1623800159936; Tue, 15 Jun 2021 16:35:59 -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 la17si360213ejc.402.2021.06.15.16.35.59; Tue, 15 Jun 2021 16:35:59 -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=FcFfpCcm; 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 01640689B19; Wed, 16 Jun 2021 02:33:34 +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-am6eur05olkn2043.outbound.protection.outlook.com [40.92.91.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1D8B4689AFC for ; Wed, 16 Jun 2021 02:33:29 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fzv6E4IKwVOJg2IGPwrI1M9A9ZxVS8BaEEQZRcN3gihFS0dayHd8acEWFq1crWI/Urh0Zoy/HSHT4b2JmkyyE4gF4DCcb52Io7vGpDBNsfsFmuKEaM5pSWbdKrU0nN6c7SCEaM7ZdiJlGcKfwiEMjN7y1K8ZRWQFtA8KtBLF9h5tXXAI58croDTIvO/LxdGMia13UR2EcfOvt5nsIFDemixJqwR4uNAgf2RAhwOdrpp+N7TDLdD+pQEaO0p/aOEqUWzH8PiWgbocxyRDYjytukTz/pEAzz2QBIZ9dcFFyUVlOiASNJzi25Yfm54zKcaVp3dqhhS7LWluIMzcYAWOGg== 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=ln9K2OHIwgwX3FV03K4GQMs/0LMan8a3mBdGAsDDrXM=; b=D3cgaFhddr/W0bzP6kP0WGEaHbLEuNIErj1UstGA0biwYvYviDUE5mY/NnQTT2Ft060oD7OBU4z7dH9w7ewZA/ePwaLzVOFX1TumPCninrrRzTOZ5VdOl5SgQk5DjWgdT3ew4MlgAkjdtfxVgysl3aJMDNla5/zno8ZkQISonH+ubYxx8L/mP2dBCqzKPT8jesPBvjbhUwqKNjYyM+r5Qx3YJf1k5BMChxEV+ret2xPgkOIJL1b01PzQ//2qgATBygUhA7IGi1qZ8tMx+9T8FbaCKqmqptwUvuZuGjgHqtU0fKQrKJhsNQJwvySj3O19e/A/VBRvjOjiTLh5ItTjmg== 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=ln9K2OHIwgwX3FV03K4GQMs/0LMan8a3mBdGAsDDrXM=; b=FcFfpCcmsFhiJyh+Zwpt9vQciA8mhOwJ0jQWU5M4hBuGth8umEeO4+D6wrr7WwrqcTYsI/xA2p1yqzngdMZYeOKlNm9g5xToXHVkWTxnQV0ZL+fC8hwLzEVbZgdjpPxVbc4R65YfQxSB0LTjWIrCyKCS7vkmQ36AU4Bek5u1l6VyO/uTu3hoPqgSFrSyEQWwsSNdgie+YzkQbUsC7mlc5j+bQryeXxuG660PVRPn7KuGtt94ukg5jFtFMIHqE9n7I0HoyDLFUb+TxJA1k29bOQRbfXhwwD4QiFI2ap/z43MRB2EEkxEH8rad2/CJ9BkoPssqnsCuvYW74hcyeQ1B6A== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::48) by DB8EUR05HT043.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::245) 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:28 +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:28 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:06950B7C37F5021C65169B9F1FFC1525AB8A4B108BAE6649023910A260BD117C; UpperCasedChecksum:5B4487BAEC53B6A6C287452D5C446F394AA5FF22487AA30B6194C80882FFE114; SizeAsReceived:7594; 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:28 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:09 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [RN90C7HOKCkOkCHyznGxAxgNBoH9QI6c] 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-19-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:27 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: e95dedf8-3892-4601-29d3-08d93055fa72 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjCyR3nvnqtBFob6iScERZNbTE39jqKA7JayuX2Vp1hjbL28NFEgMYqe2IJh6xSnPA9yz9hRaW6n316JMHlyDO2AYLA+RKpNUNVpxS0o06P3cepYkitjRStPVJIhmRiwnkS2QwYzIF+Rk/XrVp9vYvgNjfVIFKqpllPywUlbbpj6YBt7+wFxM04+zra/3fWW5XPBMDd6SsYKTxo/fGrFCi5diJaaluKpjBQKJOquqQzP7wt8/7vlvzodPsVdkdk8HCXUq1heHKZh9Yh4Kin6CLzuL1hckiqMPAJdh/VHne3y2jD3I7qy8y5qw0WKle2egqezTsFsXxnizAQObqYZokQmZ9YLim9T65vD5u1Z/WvaI3Fn+OBReRw3u5fxIITLfHF4qpWQvmOALA+/kq8pu6ZK2bkXG4t2UmQgSmtciD0FjIKhLfkGboWXYw5x6illXIjiENykE0tdCywlGMzif1ZtPRs2WxfYhxgO0tnRF8WWQEli3hqzP6ihR0xOirURRsPlaHQplHhcoOGXlfMSGa3KVa5rg4JUhw+FWs5bnTbY2TUK03/8KuGFJlPeZ0dyxyn2mKsquMvYji1wClVGj2qxblqSUg97rAM7QMVqUXnM6oLbZ5TN50b9xIilfSkAFdr+U0Qbshzls7JhRJ+XAuQv9SypW1X/2+7ReIsJUIKHhFYTzOQ3Go8szBl7V05UX0c9S04qNelwx4Bv5jvUN/4A= X-MS-TrafficTypeDiagnostic: DB8EUR05HT043: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UeecAdgUUNsldJLC/uZ3NbL3usaxHNJ4bp5aFwrhH3BrN5srmf9d/hqzNuYHHK5VfJDw0Gz5PEgYnPVoWYbpKGqmWjSHb6k6Nv2qBgPXMfWFWd1bC/NLhmjXvEOg7yMwfV4bMlLFw6Q37H2HW2SMU7TFD1E3YzXQb/GQlp9F1L3f5MNiYYkc2+BFPBpYiJ+Rc2wciop//bPqZgqtB+0Vl2etWiScyGoocCSXOh9ZMysf47zFhFskxhyfzCgIEeCx5jZCbTr5Pyxn3uiDZIJLnMP4I0C36M6rB/GlehS+qOxZoWLVUXrzh+I8JHaoGS76VQkknOZDTS6IaVzaM5ir+iYqwzgI6Nm9dPiMbetfjfx+ObWSPfYds46UkahiR2rXH4dqKqvXqvfoN+GhbDSj6w== X-MS-Exchange-AntiSpam-MessageData: BCr69J8U/XffA5L485+UNlxxSQ4xG5Pc0luDjQ4CaUjNQeMRHzDfLHeXR5jRuGs0vtxQAi/abDkSTC+9J6DCvQjSskgAAFmJR07Kn3ukEwWOBAWPURA05EZ9f6FD7PCIiQhr+sb6kU6dNdVtJ21rjA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e95dedf8-3892-4601-29d3-08d93055fa72 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:28.4293 (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: DB8EUR05HT043 Subject: [FFmpeg-devel] [PATCH 20/54] avformat/lrcdec: 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: CU9R/22rASnn by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/lrcdec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/lrcdec.c b/libavformat/lrcdec.c index 678b618498..309014d630 100644 --- a/libavformat/lrcdec.c +++ b/libavformat/lrcdec.c @@ -204,10 +204,8 @@ static int lrc_read_header(AVFormatContext *s) ts_stroffset += ts_stroffset_incr; sub = ff_subtitles_queue_insert(&lrc->q, line.str + ts_strlength, line.len - ts_strlength, 0); - if(!sub) { - ff_subtitles_queue_clean(&lrc->q); + if (!sub) return AVERROR(ENOMEM); - } sub->pos = pos; sub->pts = ts_start - lrc->ts_offset; sub->duration = -1; @@ -245,6 +243,7 @@ const AVInputFormat ff_lrc_demuxer = { .name = "lrc", .long_name = NULL_IF_CONFIG_SMALL("LRC lyrics"), .priv_data_size = sizeof (LRCContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = lrc_probe, .read_header = lrc_read_header, .read_packet = lrc_read_packet, From patchwork Tue Jun 15 23:32:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28338 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4312074iol; Tue, 15 Jun 2021 16:36:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaxdyBsBhwumUXhajJZOCAp2un9iuvrQmVduGh8SZaI3zNL61alW5BWGWCwbEP0gITwQWR X-Received: by 2002:aa7:ccc1:: with SMTP id y1mr679304edt.333.1623800169116; Tue, 15 Jun 2021 16:36:09 -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 c16si422175ejj.702.2021.06.15.16.36.08; Tue, 15 Jun 2021 16:36:09 -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=BKsL6Lwv; 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 067416881EB; Wed, 16 Jun 2021 02:33:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2018.outbound.protection.outlook.com [40.92.90.18]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E89FA680BA4 for ; Wed, 16 Jun 2021 02:33:31 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F4UfS20mGmvY7wAZ5VYoCdyZs05gSiqan38/3p5eaAwftT2/uvbeZUdAN62qUA187BWHfCUYqjZbCmCbGaMWVM1rCcize6G4yrtu/3Ok2nAKgqQ+j/38BFM9dtpWBuF1WEMUIYq7SJ16s+SZYs2YrPWiW5P2MOONlhLj9VMm2BThVHRuCGYBUc6TfZ0yP9V+6joHMvqzjIsBJd6wsuV7vsnP1ELUqjA2S87y0bcx8gGpQfKjyKDpavW8eXxZmoPN9ZSAvlZBgSUTE3q1ZtVMIwhmkDoIqSJjyZNVZjHB4ihyUdIQmPk43DNXzbXhsGgYFoyiywneqPRmTaK16KaZmg== 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=Xtb/PUuaRz8agLp0IEjXRchPYoG10zuXCa5e7bhhUbY=; b=kZ/UCJxB9kwkLfqugodq9GHw+XaA4S+WpbKllATB0h9wSSOom1WaJ+5uU3g3EU866bQtWc8gRdt2WGUu2UX9ANw2+MOGtTZvaZIQr4pIe27KbS75xCWEPW9w8SL8daIx20FVKXNN5LI87kOVz/SFCMpbEXtXyJgPu9leQP/rr7YMKTkAmD2oc3C5AfqLf01sDWVh6kGo04cykmGBiLT96CdN2uQzG7Uwhpk+2OGgRn2Rf9KcRGcmSyR99QLAbUCDhfEOiR2/NTmndDZUzl1lQZNZe4FSQchsrmrK/1nbw5i6vUDs+nYB/9+EIySWwxYy+JumVSW3x//Fhjq6uqgmNQ== 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=Xtb/PUuaRz8agLp0IEjXRchPYoG10zuXCa5e7bhhUbY=; b=BKsL6LwvJS/0lE8vqzeVPLfiH5ggNI7uGY+30YPr+gpBcwt2jMKC8cVWseyxb3mu6QFVFyYfiabS9QiuqAfrwejXthzc2VPnJmQmOXn6DUmr8z4CalKJ/H4GqUpDRuLtlO2eV/GyBJWSYVAABQGVi/kOcpMX8cIKzpdyWLQCIEoAh0Za2Qz5YIoHb4VCdJV39MVfJdVMQdLwTPll79gZdPQ2xtwmW5Urys8+ZfQ1QYOVivzhr3EKjjBfUzN2VZ7ngdiWQ1k8dwEvHQg2PIcxEpO1+A3kI4qSXJ7Sh5SbUGQlAbLwtLtqY/GkTvy2njb2OiQw+KMAEzNZOBleXZOPFA== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::40) by DB8EUR05HT004.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::455) 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:30 +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:30 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:3BC1EAE07490F89CF39E541D310947570572D053FF9BC69B5D097E1C133F1D53; UpperCasedChecksum:14761E2D286E94FA5C1E377ACAF5AD2C95659F967B54F3690480589815828EA4; SizeAsReceived:7598; 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:30 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:10 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [po6vGK+meQq6TT1H8F0ZcbKjm1BRQNb+] 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-20-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:29 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: cb6aab27-b9ff-481b-c9ea-08d93055fb68 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4p0OETr0+Jrn2aW1jxIgMYUWxrVQUWcB05H27dFzDJ1p0qd9HHQkL62yPUAWov4+5oM1NBLIpbybXa1pRJD0PmsTKgL7Jgy63fm7sXv78vi9KU6cTn9Iyb60Gcdl0piPJoQ30TEim87UPqWrSxbnl7sE290S9QM5t2pRxrgg0DJ9OUScu7e4NHNERLWhPPFHcTsoy7OWUM5vl/UCdYY5LxBkz42xkvtFuQxmqyQtYrAg/kPs+fXq1wyWgY/sc48fhRVBIvrExEGH7FG7MXq9HXHv4Z+r2IVDkrxeQzngLJjPbYiU7Yja7TyXygTuiVG3BogufWGcH7O5QaXJNxqsTvXtxKz9us3kKFTqewuCOOq0K3Saw17lCjCsuoE5RvBdeakWXGjmCEp0IsX+wtBMI97soGouaww5TK5fLtj/41RVDkBiSR4T6wO3yU0krkd9SiSxhSPOK2OMSnZ3aDrKvKdPNIPUeM7y9YToYQKP7r31FMVImOt3B+zPQXsOL6JVKmCXawKg8WmsLGlkFP12GFSMJxQln22fdHhxn1GY82xJ2IpHETGH/XaJEzQD/CNQGnawTrnQ1hiF3NFoqM9KQANcJu4DTJszqpdYn7MutaaDXHfikIk7stFwM3sBoWO4Cv8GICxa/XH2Wx2PzlGkRKF7hlgVn9CpFJEzciH67WdS+jmOQcHOldBNku1ymkyGQdLQw1K/zOHTQdlK6wjZ+4ocoFlH4uesQ1hO80gnP6EH0= X-MS-TrafficTypeDiagnostic: DB8EUR05HT004: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pQAEtIbEma38He0Z+yckVNArrQKqeJGMWjEPoKkB46LdPMj5cMKEP8B/uISZwXwKj8GhJnKVWu3jLczOBuH8N/PMf6B4bRQwaSkKUl6eC+jn5qSdde4jRGt0G7wclI89NaYGkENDk8prRD2MNoZ3vu1iYwrJlESGQca8g+HpdcIyZUd2ekvszTPFZ3Kac6wRzDLnoLYGVx0NxnCS3AJE5YvNwtDOIGu7RbBeKX35496f2XzuqM0V7yhsHAn9O1h2HSOHm8rg1xvxHyGWw0xeUUcUatuQ0Y5jMbHDTW1ULjfZH+8MQ7Dd04M7TfSnjS2VX6cqj7ER8z4P+RmS9LJrkTbBbn/K/JNaAso2XYlojuhMM/FLc/xUFwPOFgwM3WFVldG64FqnBpysdRKX+IZ2rg== X-MS-Exchange-AntiSpam-MessageData: /BVFEpmZOCKy8fbKkkcl9XXiXHNFfSvSk6Hzh6wz6mr+0c/7GS3QINxzH3qHitGtQRSK756w4OKd8HNKf8o9DbDZKpGhGHuYgJDVvzKuJauQS111yjx21NBdrplE/d1ovzXqtvZgsQntBCGV/aLgjA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb6aab27-b9ff-481b-c9ea-08d93055fb68 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:30.0276 (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: DB8EUR05HT004 Subject: [FFmpeg-devel] [PATCH 21/54] avformat/matroskadec: 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: Bk95WziqikyZ by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskadec.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 356a02339c..10c1641eb7 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -796,8 +796,6 @@ static const CodecMime mkv_mime_tags[] = { static const char *const matroska_doctypes[] = { "matroska", "webm" }; -static int matroska_read_close(AVFormatContext *s); - /* * This function prepares the status for parsing of level 1 elements. */ @@ -2952,11 +2950,11 @@ static int matroska_read_header(AVFormatContext *s) while (res != 1) { res = matroska_resync(matroska, pos); if (res < 0) - goto fail; + return res; pos = avio_tell(matroska->ctx->pb); res = ebml_parse(matroska, matroska_segment, matroska); if (res == AVERROR(EIO)) // EOF is translated to EIO, this exists the loop on EOF - goto fail; + return res; } /* Set data_offset as it might be needed later by seek_frame_generic. */ if (matroska->current_id == MATROSKA_ID_CLUSTER) @@ -2976,7 +2974,7 @@ static int matroska_read_header(AVFormatContext *s) res = matroska_parse_tracks(s); if (res < 0) - goto fail; + return res; attachments = attachments_list->elem; for (j = 0; j < attachments_list->nb_elem; j++) { @@ -3005,7 +3003,7 @@ static int matroska_read_header(AVFormatContext *s) if (st->codecpar->codec_id != AV_CODEC_ID_NONE) { res = ff_add_attached_pic(s, st, NULL, &attachments[j].bin.buf, 0); if (res < 0) - goto fail; + return res; } else { st->codecpar->codec_type = AVMEDIA_TYPE_ATTACHMENT; if (ff_alloc_extradata(st->codecpar, attachments[j].bin.size)) @@ -3040,9 +3038,6 @@ static int matroska_read_header(AVFormatContext *s) matroska_convert_tags(s); return 0; -fail: - matroska_read_close(s); - return res; } /* @@ -4236,16 +4231,13 @@ static int webm_dash_manifest_read_header(AVFormatContext *s) } if (!matroska->tracks.nb_elem || !s->nb_streams) { av_log(s, AV_LOG_ERROR, "No track found\n"); - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } if (!matroska->is_live) { buf = av_asprintf("%g", matroska->duration); - if (!buf) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!buf) + return AVERROR(ENOMEM); av_dict_set(&s->streams[0]->metadata, DURATION, buf, AV_DICT_DONT_STRDUP_VAL); @@ -4268,7 +4260,7 @@ static int webm_dash_manifest_read_header(AVFormatContext *s) ret = webm_dash_manifest_cues(s, init_range); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Error parsing Cues\n"); - goto fail; + return ret; } } @@ -4278,9 +4270,6 @@ static int webm_dash_manifest_read_header(AVFormatContext *s) matroska->bandwidth, 0); } return 0; -fail: - matroska_read_close(s); - return ret; } static int webm_dash_manifest_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -4307,6 +4296,7 @@ const AVInputFormat ff_matroska_demuxer = { .long_name = NULL_IF_CONFIG_SMALL("Matroska / WebM"), .extensions = "mkv,mk3d,mka,mks,webm", .priv_data_size = sizeof(MatroskaDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = matroska_probe, .read_header = matroska_read_header, .read_packet = matroska_read_packet, @@ -4319,6 +4309,7 @@ const AVInputFormat ff_webm_dash_manifest_demuxer = { .name = "webm_dash_manifest", .long_name = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"), .priv_data_size = sizeof(MatroskaDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_header = webm_dash_manifest_read_header, .read_packet = webm_dash_manifest_read_packet, .read_close = matroska_read_close, From patchwork Tue Jun 15 23:32:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28342 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4312180iol; Tue, 15 Jun 2021 16:36:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0csYM25qz1mLoo5VkekoPexDvPjKn0xdHjdZgDkw9Oyfd26luQBH1dByMoAcpA1Fvzw7M X-Received: by 2002:a05:6402:520c:: with SMTP id s12mr709023edd.304.1623800179031; Tue, 15 Jun 2021 16:36:19 -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 ca23si284831edb.573.2021.06.15.16.36.18; Tue, 15 Jun 2021 16:36:19 -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=FQkrn+Bn; 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 E6322689C64; Wed, 16 Jun 2021 02:33:36 +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-db8eur05olkn2030.outbound.protection.outlook.com [40.92.89.30]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 44646689A4E for ; Wed, 16 Jun 2021 02:33:33 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X29hEe5e7Em9K4JLfJKVDTefbO6NRocMGhRLdygvPNINzpavAO/wt0negOPUUt3H1jraPI+gN9Oz1nrFgqIheI1C/r8Z2ctQyVZNHFzQeV/02Lq81jnQ+735d9iBYc0t1Dk8A5QEvNxIyw5T6ydiGDycJFtTS5sxj2F/4YhCieK/zFus651a0Sg7cmm9vIpj1Gaw5Cq/iM1rSRcXzw6ip+CRgfeFmcBgPkNXDXkuX8LqdXERpWdgKSLeMxJTSlwv7OOmfcX/UBXVFAxORKsZTIYm30lD7KQSfPqLmkkW+a2tAhW5/Q7S8nUyAjCIdLX8iXU1YI4rdzAOyeIeCSAyZA== 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=FTRTl7nQc8U8ud1fjdGtZhg/VASqrol/AyTiPWf+3UQ=; b=L/iB2wqzRfrjdyWHSJPdMt3yplAWZVVcDDw6jveyTxlVWS0zwdrlXk4CSUOx3y3gb649Yfh1H/kxdtp0IXDYq2qBvqWIS1L8Gq9vtJZbwY3X3NaCMKOBpofUC2XlWleFxdvSFjZ2xyf3AY/okWX9JN6q+sPxUziBcxgQbkYXsNiwU66zewDfwEVK+pNpy4Wz6o84/IpzVsiQGqwGfacrn05pOL+Ir49SnCOmBtvJKyWsVSE8+oYxGWf6K8VrmfUGD7Jhc7x/FJi+gPOeT9vqjixVXTMKrCYgJWA2UGsUM9mHDXNqgLw++nn+/sbRiFa2UwvnlpQf8wJntth1zIfcmg== 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=FTRTl7nQc8U8ud1fjdGtZhg/VASqrol/AyTiPWf+3UQ=; b=FQkrn+Bn/FoNSnTCo/U2WQR5i1r36P8s6chv+ar3n1L8u6sLK5gwx7crgCFnTeXMzvU/OfkMVMep3XdDo9wEfg6ADALO1G3UfK1jZVf18PEKlS255SjMdhaAyqFG5UPVM36PxSXXlWfnpGK/Dwjk7UArt7wpuQCEV1HZBHwdyW3CvrhqBa2GoLMx08UkUbIiz285d/dxWQNUh9MrXuUrDO48EKfoggdN1gQZU7Q5CyMrUE4njaSkvVxbGDVPYpoTs4nB/2QQH+cCNYzi60fKXy8B72iXQgQoShVvOmz+xieGeNKDpaGLroE/QSdw8G/5MCz41oFAZEWFj/x1zsq1QA== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::52) by DB8EUR05HT163.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::472) 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:32 +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:33:32 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:DE79879E1064C2AF8A5D2241E3BD71F9871E72C71D3113B3DE605AD0EFBF2007; UpperCasedChecksum:51EECDB344B47F9043697BCA016A280C107613CF3F92BCAF5001C743DAA7E850; SizeAsReceived:7594; 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:32 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:11 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [/950BO79dhvM+D79OXYHEATqZ5ATTcwp] 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-21-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:31 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: b51a9f89-6915-4b52-bb8e-08d93055fc78 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjES5i7NcTDYEwSrIFD5q18l6MMZpVzRwr73uWay+0YiWGMkxB/DTecem1UkxAbit7TWepaWvNrG8hvA008If7YgD2nqIuYsmnRK3e8koIduMjZ71Ywx7XyOif6orBTIWzupWyERMA789ZagYTb/C+reSaPkvM2tkVbMgwr4vsltDDxeNcicfmg6o18TkIzQpqC5nHmRd8S51dTiQ+WznQO26FiahLJnGrSAMHj4Oatxy5SwwTdxpVkVT+Wf/gOj4N0Aa4HHJjTtx1MaAGgqpehQshXz6ZpUouPzSGoC/5OA5kHVQzhgCAjYGUdLwRLcMLVGp09Py5gdEBEXkpJ6cJPsCkOyV6/xYBnlRr5zh9WESsyP80m9uuI8uI9iJB2rDO1rgIkvsdI98JuUNSSPCD52gd/gJwq/qLmQlkciLVJhFwNASjej8AqqoO+gmhfAq/wQpvUphvuNp7SdJCM20hlWLrIkwUaG7Gvk4ZyzDYogpVKRPk/KzkHm3Lwos0uuExnDnQiV0emooBW0q2Gy1rsKDdlA4WceOw+3Qxc6Am0pfsxLa9FedsZEJITyPuVLMoTJkwwQxpMiKtWoibUYZFh9Lf/+o2ByvHdUamNuOjSLpuKsWGQiduFV3kEF8SOlg6Cw3fTJXsadCGZ/01vmYxthqHYC3yV5FpVqRMmUtm5ZRK1aGaEpJXOBdDv0LXgLPL9VdjUD4JA/LOUTl44x68fU= X-MS-TrafficTypeDiagnostic: DB8EUR05HT163: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FIB/LLcxW2xVSmiO+Jtuq50/0yAn4PUvXaCBpVWUgNZgbpVkcedj3rkjK9hfK912TUWjIG3yIiJAySwUXnr/9ydbALffNWYC2DKGOU4ZduXdJeeg3cHrjuhibt9AxdhMSvH0usnAdGuIIkIZZJGfdKTIbb+HBPTuWHJNXPoDPbYvl55fiyZiPZWoxQq2qfg6j92sHiMW9kpj70ET9E3urlBU0EudKZs7oD6i9zQfugcZBMuogLXiqGjQJrJ3cMfKzUCEMe9yqS4C3LyqU5057WqVd0WojGGlGW+XsAOoYUF36PKWCpbgFb6AESep2SPrJp5CTukBgh5FeIZ1bUcvlKNSXq/2SazJT+U4jCSnBiPSKWGokL8l7TxPvnWZ/NuprAZmUMD2WiMNonTzTnE0GQ== X-MS-Exchange-AntiSpam-MessageData: w8KiAfBHliGFJK5BhFiX/vTmApFJRw3J/ev2cMtOC/qBZqPkW8C6eeClYbcwRnemHCmjdB4FWr4+4XAYRkjDZnE19HCunySVoX9CPEZ9896GvZC85Llh0h6SHHIGj59OWLwHithIF7UWkPwow3ofIw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b51a9f89-6915-4b52-bb8e-08d93055fc78 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:31.9648 (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: DB8EUR05HT163 Subject: [FFmpeg-devel] [PATCH 22/54] avformat/mccdec: 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: LZCcvz3tPnQy by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/mccdec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/mccdec.c b/libavformat/mccdec.c index a096ac6e93..d206fc2d62 100644 --- a/libavformat/mccdec.c +++ b/libavformat/mccdec.c @@ -189,7 +189,7 @@ static int mcc_read_header(AVFormatContext *s) continue; sub = ff_subtitles_queue_insert(&mcc->q, out + start, count, 0); if (!sub) - goto fail; + return AVERROR(ENOMEM); sub->pos = pos; sub->pts = ts; @@ -199,9 +199,6 @@ static int mcc_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &mcc->q); return ret; -fail: - ff_subtitles_queue_clean(&mcc->q); - return AVERROR(ENOMEM); } static int mcc_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -229,6 +226,7 @@ const AVInputFormat ff_mcc_demuxer = { .name = "mcc", .long_name = NULL_IF_CONFIG_SMALL("MacCaption"), .priv_data_size = sizeof(MCCContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = mcc_probe, .read_header = mcc_read_header, .read_packet = mcc_read_packet, From patchwork Tue Jun 15 23:32:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28345 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4312269iol; Tue, 15 Jun 2021 16:36:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm/8JrbW9xXh3hbcY8ueZa7NY85j6cE5OsEsjYqRgKeb0+Q+ENhhBxNC+u0jjkn7Nh93Ah X-Received: by 2002:aa7:dd14:: with SMTP id i20mr733363edv.110.1623800188254; Tue, 15 Jun 2021 16:36:28 -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 yh29si450917ejb.42.2021.06.15.16.36.27; Tue, 15 Jun 2021 16:36:28 -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=JRWxLMjE; 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 47CF8689CDB; Wed, 16 Jun 2021 02:33:39 +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-am6eur05olkn2053.outbound.protection.outlook.com [40.92.91.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0E6AD689BDB for ; Wed, 16 Jun 2021 02:33:34 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jbYZlIoiVog3oK34AWX6g1nSwDP1C8kYz6nj59qisxxHiYimtG21Xjy2xx9oPhqGBXYahbV1pbWbklLxZUAYv/ou5MdqWzSRGpzKWX/+0H/EslPfkhQBSuEJH0FG88CQW8bf6uvZ+1N6aEgdMRqqylGKw8jV2YEWRbbrY1BmRov98dVch9CJFMgZuZ6uGl7fgEcZ1SP9dyyFQcadNv7DvIaOyWucqCz+zlN20niYyfa8cwfoERCd/xZnh9fcLmKhJNOaa0iVLzloBsUQrs34mx6iZFDceq5Fv2alH/HJ1g804cRa55ipeBtAdgD72JbRKVJb2GZ0YmrAwaJpJ3tWKA== 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=Qs0oROoMOsL+VOrog3I46xlWsZ8zKeiD5cWBrATYBmY=; b=HMtN8X/jzMIY4rGdf6+YmXSqDG7gzKxAzHzbU7EdUi8/U6JXv4a3vNgvz22WgtnjcGDvhbQb+gzc+FDP+B4X21RsQnLJn7iOhNkj8p57z9+fLz+dhIUXy5Ut2JmxLvz5hYfrv0TKn/YxRpBlx9OB8JCmn1Wxnrmpzlr4/vjSXQ66YJ8pvpE6kXKNTJcAGDZhkr6LWnsTo7q4xE0LvoYxUtx+ZxonvG5axqz1PaJ/zkxZthoUWXfXRqn300ce9zxXACgzAJjojqVRSnNY07J5B6PnngyFaS5TlnL22ZVfL44636W7jcMcnWT6yqcVOgsh1vPTJuhMcT5StThqu2PyxQ== 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=Qs0oROoMOsL+VOrog3I46xlWsZ8zKeiD5cWBrATYBmY=; b=JRWxLMjEHbfaglpOnsd1mhAZRFoJ4/3LaS7S65NhBrqeObnpZ1ScEfckZKKDhyRnVswuixu3incHRp/P6sSFvak63cLgIBIydGVAXOeNkySk2uTPibiSCFyUgzDnSNb3jwbpwZElJFRFdOnAB7xSNIME8QyXVHVEjz/bS4/SchliN4mgBv+5SMphWcctgkb4+9rjVarKosyO6rH+dG77rald4l2LCiMDeN0uT46XJJLJ/wRL1zRoAUm1Jv26wLJksXGJ0zQe+5FvIcxDwElcgsQ5Tin9Gm8Gk3Zs5WJpyCLmxW0EQrOepTzpknDwREpqNxyREYzpa6tpeM0ZWW89jQ== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::41) by DB8EUR05HT003.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::120) 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: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:33:33 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:3D84E1F6430B94251A3B1D2DD1728BAFA0A436789B938FB49BB8AFA032F733AE; UpperCasedChecksum:68711C366560606B2B8C1A442F3FF4C836FFBB96C5242198212A6381DF1AB818; SizeAsReceived:7598; 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:33 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:12 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [wyAbTKV+CqgtqmhOdKBHP60omkUrpw9u] 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-22-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:32 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: aa7d83c5-0138-4f65-f472-08d93055fd56 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n4p9PDP/HNk3thI8nQrnqw2wFFE5pqWgixpvwKcG5Jvtw5eHeUosNQLm3kWO7H/UZkbLjW9tw2kTcADtW9IzgLcnQiewrqaEItVS5PLJsU6CXLThvWliHzZ5t3xmvmsSU4+e/kgOIIwz9BREVQUlwFT5UwYMt3G02TSXuJ0cs3hGm3ypPn+g87EQa6V3YWbv2ya1XuSAdKE7lbxZ3K4zYjO6JXBfHXOPpVUtjbBeTtsU2siPBWixC+2Twdp+GhRh3GnH2I9S+f8ZrXUaE/LzFygVg23hjRqJqY/EWMhktV7/wHNMKoAn10bT41KvJvVQOQddmBnWUSbZrDiR2sPlXr3n7A9SYcyhl+IgqL5SaGfWnJdf7KK/KzDbP5gIebEsjtpTcvrLWqCs2sUTZvVgPN3sW1wOlRYAcDCXxx2r/xikOB6mq7GC9E7tNlPqiuoX15oG8e4x1BbZsANX0ib8REOP/MYstiQl9Xb7eLeI6AJBY8n8dbSAoO3/DpJGxfNxAKORmP+I7U9NN0P7T2EOeLHk+tBzJOymCZRUgpSIwqYZXhKcz1kdyjOjcRlDsCaLswhnlkm5THHqhMfyJHpiDHbfcGDN/aFZH3SAmdZhkdPVK4LYLqOf+Ss+N/fSTh7oASeGPckBLYA01KDUjTXXWNVgALZoLIM3nQjLUpW2IcUYGe7IqLbg7YzjP/vqxY2oFJS/oXdSFwEMGDMqUQyCmHkQ+VwORJ2TYM= X-MS-TrafficTypeDiagnostic: DB8EUR05HT003: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LlR7jWgQdRcHWJpytLpBx3JlkUKLwSVyorhZB9B/Vu/a1W5n6+4UbwbsM3NjWJuCTV9LiyjS/mdAXaC4ZVU5TREhtoHuVIE6dYklIOctqbPpY23KEcogJoNuEF+ntDx1h9FRZNqhN3TQ6HF4HnqQ8ZmvE+eGtJI3c/ZKlyY8qJJnSxvBxx/yT2SlSJJ6AIGnwUX641QOVGIk9d/1/wIG/dyLvy8bvpSKvfys4sioxgvh/7BnyrPDMSfXkguyR/xenMfIKAWfGcANwVwVfwahfHJLuEbRkvG/1huCx1sb+DDXAohTSD1YimIUa0IIHKqweeZfh4Oab84e4X/qdLpy5siU4SjD31LQXlRhxmDIWBthTUsdsEISGIJdGnfSOMDiRfU9fHnmB29h0tT3aOCcPA== X-MS-Exchange-AntiSpam-MessageData: j07aa5uTQyEE/8/AF5a1XUpAsm8tQdSHRHYnrQ3FVE+KVwkErg2s65I45PYprMsuC+6gQq4FGXJd2+TDgKcwfxLViiCyeyIsI1+SsPtxkp0xdtR8DD9Rxl/kXncvrpZ9DlOObURwgTbxkobHpO9jBg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa7d83c5-0138-4f65-f472-08d93055fd56 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:33.2922 (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: DB8EUR05HT003 Subject: [FFmpeg-devel] [PATCH 23/54] avformat/microdvddec: 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: HY5UFn2LYWIs by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/microdvddec.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavformat/microdvddec.c b/libavformat/microdvddec.c index 3c45c72595..e536d12b85 100644 --- a/libavformat/microdvddec.c +++ b/libavformat/microdvddec.c @@ -121,7 +121,7 @@ static int microdvd_read_header(AVFormatContext *s) int size = strlen(line + 11); ret = ff_alloc_extradata(st->codecpar, size); if (ret < 0) - goto fail; + return ret; memcpy(st->codecpar->extradata, line + 11, size); continue; } @@ -142,10 +142,8 @@ static int microdvd_read_header(AVFormatContext *s) if (pts == AV_NOPTS_VALUE) continue; sub = ff_subtitles_queue_insert(µdvd->q, p, strlen(p), 0); - if (!sub) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!sub) + return AVERROR(ENOMEM); sub->pos = pos; sub->pts = pts; sub->duration = get_duration(line); @@ -162,9 +160,6 @@ static int microdvd_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codecpar->codec_id = AV_CODEC_ID_MICRODVD; return 0; -fail: - ff_subtitles_queue_clean(µdvd->q); - return ret; } static int microdvd_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -207,6 +202,7 @@ const AVInputFormat ff_microdvd_demuxer = { .name = "microdvd", .long_name = NULL_IF_CONFIG_SMALL("MicroDVD subtitle format"), .priv_data_size = sizeof(MicroDVDContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = microdvd_probe, .read_header = microdvd_read_header, .read_packet = microdvd_read_packet, From patchwork Tue Jun 15 23:32:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28376 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp124396ybk; Tue, 15 Jun 2021 16:36:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSkHRhR2syIstBWwyBIHzAsj+zTPxx6KWZwEjug33uzdNwIYPcIjcSVtRJRqwnxT/pWwDv X-Received: by 2002:a05:6402:31ba:: with SMTP id dj26mr686890edb.71.1623800197921; Tue, 15 Jun 2021 16:36:37 -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 rk21si424612ejb.212.2021.06.15.16.36.37; Tue, 15 Jun 2021 16:36:37 -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=nTmqUa86; 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 329CA68979B; Wed, 16 Jun 2021 02:33:46 +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-am6eur05olkn2056.outbound.protection.outlook.com [40.92.91.56]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 74173689B33 for ; Wed, 16 Jun 2021 02:33:44 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GbuIfOj0t+447SGMXxcpKItsXQFEyYLOhx957mIc4mxElQlPPrtUcrIXsLhxUBeSRCJ5asRAW3E2kBQXiDfZQo+HEdEkCEU2ivK+JFUgseYbQzKUIp1z4dM418j3ySv67l0V2u7zJIeRU4/rAAqFzbT7//vmslu3+pWBURoJdhCPonh9IN7mzwD6zz8+RPg68GWlVVR9/csMpcGrdAc1A82Mc0BppNp2jgwSvZ/S6st6lNC7Yd+mUSuycopOn4M9XDCe4V0aKKpwM1pOV+kowNqPTBhXhnCkiE/1gs3nlndc9DoamYemuUe+RZL7GsBggOsyWNjIEc/CQd68P8gZNw== 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=K8zHNqRRhbJHF7lhT068TcYis1hlWkDxHwq41ITeALc=; b=mDYKnslgiXDWohjTR9/KrwcKqZXdmKZ9AXmKv8MwVKGH6GF5U7MGlXRxNiFceTzcz/f9Y0csDaTQxhjnkU35oeHgrBOUZVc6Lf3NNWGgJdr7r3uVB2VDxBeLo5c8T60jk7QKvPQW+c/ItAZr0n+xczyfypeM1Jk9+rwLrrgmpCux5NQN+oiDbRmqiytnCpkgIJwOoEixDf7DKXWmnVZJxa+ec06s+rDmvMndSDNz8wDMmaZ1Aod9T9OP/k6nLFYha+EXmB1ptN5iMdatGUaYPJ9LX+Z4KtgqmXVTBODLp1NddiStpdMOSqVTAue4I4gu2FKW1nPH7OlXneHn5Gj6WQ== 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=K8zHNqRRhbJHF7lhT068TcYis1hlWkDxHwq41ITeALc=; b=nTmqUa86lxacbXGBHeTDND4iH1/+3VjxdGAH49XiYkOZJPAUSOEqk/N6nt985ZlP5rFtAshoYuZNy50wXdU4ZAOQzJlIKITVpu66dW9vI9odXnKIXcbHFn+CkJ1BFiPfo9vL/yCq94qb8MQdrhgHRtIOZTDDTr6Bhm8IZ0SgJ353Ljdcf1Z9T/BAd8Si+7i/yi8ZJHumcRJa+loP/7HHt/ZzxVVpmS5k9pyJIAZogkcB/2QSrWJKJzknKTNJSMRiLQE5vVKC1S6WXUHCQGSOy8JV+KBsj+AO10hHoMfTTgXtBo+62OUU36dATEXknsQ++SjZhwTuJpR6znixuqcxwQ== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::40) by DB8EUR05HT223.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::432) 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:43 +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:33:43 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:6AA6363998DFE1183ACF5BCBC03808759AAC1DED3D3C6151ED18868FBEB62545; UpperCasedChecksum:92997ECE26747E8D2738B29748C850C54649FB2D5538BF5D7D6186D62CC16F2E; SizeAsReceived:7593; 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:43 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:13 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [P+vkq6lH9gOwykHspfxEmVZQ6syH50G0] 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-23-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:43 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 996cb3b1-f32b-45d9-55b6-08d930560390 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjCyR3nvnqtBFob6iScERZNbTE39jqKA7JayuX2Vp1hjbL28NFEgMYqcwedC2DxLu5cb2hJthT3JZFHwTdYUmEy0QNM/SzsZna/8MfP2d6nK4DPkQiZnFyucBFlGSlgwYy987qo6tdRwKK+zRLlGNDstcGJncVen+peJI4mFNX56sOKFhyU13/QrULOuFOBLbHl4muw6sl+9Cm4CpCQOc9Ini/tjqLzNplLOTVvxXp/1QUOqdLF/jOGJNocpFizIRmGhEAx3PKrtPIZD2zvTVVmQ/Q8EVgU41ClHVJIgOWlDzgXHhy+lPFLOdHUd9HU+k5H1uVNlZY4Hu2dE+hqpnhE8vWC2mCzmcVwegwDGM0gLmNSkkXkZgPt0CkxnUBmQzrMwlYuTo5cu4EcKt0dNLh6ztd055pJQ6evJ7lLU2h/LVZTgexI8PPTy6dcYg9VUGUu0uKu5DxXYyF2XAb1RXvJqbhg0vIFCp7+XV24P+ppzvrVT4tuSyu4x2Y9QPiQQ8So4H7Z2a2R5Y9h/vW/Hh7LxxhwzAceJj8ovSxT6kzYgvJYdRYPA011xGRLLWkB6XjQ0OYG2yAme8TH07Ek9UIUVUC/b7KxqzyVxI2bNYpxmi5pS9Qeii0iBQknoFfyw2opsIpPQ9J77BLc3g341qm6YJzdp4cfFPjdTYgivTXdgRzVTKCRJlXSWmTTxAaxlOKO7cMXXAo3w7NVjAYl7r1Rs= X-MS-TrafficTypeDiagnostic: DB8EUR05HT223: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: haSoToQvFBaTX5ZtdFTpAiI7wKagmcs2ryu5oiwNrX9Ut8OxHG9QORu1tu3FaFqC92esUso5HVZC37L7ruLvckvtpzl1JUGGY43GFRIGiHW4NeOIOkRnInAjx+DXVAUwkT3Pf1t0EIS8M2OImdEdyNtX55HI60KDMbEe32laoIAnW0MIPw9+Zz/MUlZgumhw4vN0vojgq97kBLShoAyxjkLxgWqcFGN8LeBrQHyskDhRHXuDP2ZpyeK76qZOEMyhhtS0tA2sRXRvs2sONlks+QfQAd6hys9XGsFnQFynbI+Kp71SdDo7KvcFYopkohwKF+wBAZvzap/A+3N23DyEjkMxaIO2qKtSLZnf1eZ3bF2WPQhhFOTQdSsvgkGrLxGGC5XnW3pBGpRyn7inz+JBWQ== X-MS-Exchange-AntiSpam-MessageData: J1x2QfKk2LuywztLilmGxLwryvfTBOPLz1SxUPHeZykZ0vkuYvNLIQj0YcCUcpFXz9SJ7/poh0N/NHQpDF4SFZCj6aku7UYQHuZJPYrZkFSDWab7hboM9UDIjcaAwHMP1Ehc1q0zEcdezehoP2QLmQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 996cb3b1-f32b-45d9-55b6-08d930560390 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:43.7346 (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: DB8EUR05HT223 Subject: [FFmpeg-devel] [PATCH 24/54] avformat/mlvdec: 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: pvfx6IDHFHHc Content-Length: 1477 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/mlvdec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c index 998bf42dd6..6a3aa15a4e 100644 --- a/libavformat/mlvdec.c +++ b/libavformat/mlvdec.c @@ -52,8 +52,6 @@ typedef struct { uint64_t pts; } MlvContext; -static int read_close(AVFormatContext *s); - static int probe(const AVProbeData *p) { if (AV_RL32(p->buf) == MKTAG('M','L','V','I') && @@ -380,7 +378,6 @@ static int read_header(AVFormatContext *avctx) if ((vst && !vst->internal->nb_index_entries) || (ast && !ast->internal->nb_index_entries)) { av_log(avctx, AV_LOG_ERROR, "no index entries found\n"); - read_close(avctx); return AVERROR_INVALIDDATA; } @@ -485,6 +482,7 @@ const AVInputFormat ff_mlv_demuxer = { .name = "mlv", .long_name = NULL_IF_CONFIG_SMALL("Magic Lantern Video (MLV)"), .priv_data_size = sizeof(MlvContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = probe, .read_header = read_header, .read_packet = read_packet, From patchwork Tue Jun 15 23:32:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28346 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4312456iol; Tue, 15 Jun 2021 16:36:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNhiWQhxYhV2yok1vYHcGPz617k0rx2LTBp4jbfAYVdlc9YTMxRsjomg3msI3OglO6WgD+ X-Received: by 2002:a17:907:2642:: with SMTP id ar2mr371641ejc.391.1623800207220; Tue, 15 Jun 2021 16:36:47 -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 5si391853ejh.535.2021.06.15.16.36.46; Tue, 15 Jun 2021 16:36:47 -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=s5gcyeQy; 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 DA7DA689B62; Wed, 16 Jun 2021 02:33:47 +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-am6eur05olkn2104.outbound.protection.outlook.com [40.92.91.104]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8FC36689B33 for ; Wed, 16 Jun 2021 02:33:46 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=myl7XlaJi/IBNoHDScsd3C42ZjORDJjbO/wDgJifdiEUzYntWoRfPEJ5UovfZQvV40UgFhb/Ry0DZRFbvKCC6xkFWoB3tTmd8+ii5nj7oAHMBrFvJkYmPZfDFCvF4dxWpHl62I4BTwdA7mxs2fNITs5KeCs3JV1itlEnuULLKSg85BcmlAUBd+plMfY4bOnD+GNyTxdsOTS9j6DxXJM2SpR0kBk48gmopRtEZECsFQNEnYxmxZRSBt2zeOkPtVvsEutb7NAHvPijWk8IKw51bcZFy/UHmDwIQjytAy/g8m5ywg/CoqqLDUv6s8MddPU6OgpUc1A7misU2u8PpxeZgg== 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=OQfGdEj6kNwffsXS0lq0b2DHC0sb38HRCtJVP+0c/Zo=; b=lJVutVDuT91W2qak/+rgzTFbAmmlFNa5dMdXeqG686zGo70yWi1r9dmuw2QtAedWQMpda6BC2RvJ7H2uvU+IBRT/hWVqmsX82KAz7IpmKHVRMe7/iawQi/b4U+LIobRJhgxd9LaD4t7X7plRx/UirXqZkrvfiUkSPRhZJ1wB41IsnP3p4B+jm7VfWuz2o+YUdruZeJ431Kg+NsyIonDDR/qlpN9hRXqsON2uGGi0mEhIsxFl6JkIbf2rj/Am69p8N1he5jKYCWCZvc19dtOIhwklcbWcXH7i7bufB3VuCRhC5HXgO3PI7wv4+4DRlzSYXzBPpAwWgdcoNq7LrxYZ+g== 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=OQfGdEj6kNwffsXS0lq0b2DHC0sb38HRCtJVP+0c/Zo=; b=s5gcyeQy8p1f+OM4XuSrlpnI5L0cf2beq5eAYfrl0C0hsDvTh6UuYFr1mPHoolARo6xTyl8czcaupDzexhlTTg2T0KSrdQ7xUPMKIGyjxFzfVtocD7B4pmI4mG+vH7bby/GklmtstwAdX8UKgcy/Nyd5kZvX7usz94kcRiwHA0qzqhoUIgymo3guHR6vGX8b+/XkRFEmSmDfh5AGHhMsFlSq3qXwdvvL4bcnL1SG7NagUQ1YyUJcwJuylBrBpz1neyuGaTE5BTcW5yj6Qu3AjaRE6k8rQiMbJPIXR5jMqpnuKlaoFwENJZyy8ZP6/jUHCp79+KXblJT/+eXha6dOXw== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::52) by DB8EUR05HT119.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::465) 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:45 +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:33:44 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:8C5DBAB2AEDC97B7FF5710B1EAFAAE37434F9C003BD511203DEBD47C8714719E; UpperCasedChecksum:D772F0482F1DEF833DC3F8D7CC6A9EDB1AA0ABD4F2646FABEECD9DEFCB41DB06; SizeAsReceived:7581; 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:44 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:14 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [cDGpAVagzJIv0SnAK8i7F4c7X6bNZYm9] 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-24-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:44 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f24dbaa1-c112-49e1-f87c-08d93056043e X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pWhkGqqrkWQJ/G2nBDhW1ViMQFHGvL0m+wmtApeSvE/Spy4GWSmsQRH5CWTHd/m1gGLfFEYj/0TS5PNIsXjrah5i+TMPwQx18QSWWGRzdLDx1ZhCvt3KTu2H8btvlGv1TukI0E/Y+0j9L/itU95Ae2t/DvqxEl1HthTCR09qPzbvM2O38pTsMDYD0QuY6JeRqT7U5Ad81/9qtZeEPxXMIu5xt4WCbluKhi0dXwgrwFz1K9MvJAuSkPuZCehrHPX/wSjBmojFdphEcORQ8zVTynJeBshlP5Llr7in20/6+px3TUfjdNU5+CtUOoCUzlN2nuQXy5iRMVEKnRxz9wPuhtFXTkSCFXYiEyhHa7iq+xq3GuiURXNuB/orUDGdUjOzUdVJViB8bSyOJd6fc3pIowizrQ0e9T6wWW+HWiq4uolXQDs5jSg0+UAcXzsh7ckOnd4OBM1cwfwxYse84wLdZ4Ko1Vf7ZQDTLTiVlgpUbzqLqKsbTea56hehqDi25OYYFCylIJKblNiWdnmhaaIDrbQlySMYEwlyvBCM+mIze6HodlT2PnrnzCJdpiMZsRa3WMHoTQ2+p4V+nt+pbQ5RhLxqDQXxpPQkmrZvk6NvXNRjU0ukfvRCuQwQr17DTXotqHcGYgKENQSpUYTCLAiqhC4+QzD7sH51i8yvThPREwUHLBO3SBMSt3sVQeI8gtPiKUELLAlV7QWm9A73E4fk5PxeiUNWfWqdapIUO+IcAPyQ= X-MS-TrafficTypeDiagnostic: DB8EUR05HT119: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /DVE/zHiX3LUu108qZXKWUoSSjIhQCxQTTi+ZVZQZrRRpCuzELqJ+cF3IWcNnlaQQ7Te5GrJApFnRSF0hIq/07B/bEenFnSIj1a6d6KRazhrxiTQEsuB3zt2KCcoe4WTj29PlNiXo4fjdry45teSQHaMoni5hbI1/Y9y3JhkyvzvX+HLlL5Ix9/U2qQwU4S9p8mAxVDTQpTowr6pSZP4FMCwL5k68WG53r/P8+TCwD2lbfe2HBVDbOpO+hWRE6G85wIqc0ekHK2Y2oYJBd54oISyEbm7qqiecCA/dQm2ROnKrydO7NYfleBxs1Dd3EP3dp3P/uK2qOA89n21dIBY930YmwumCxz5nCk0k1QvR4fxo3bb6qoq0BZc4bW8yYOD1ZrNWEQgYDKrr3pUyhagtA== X-MS-Exchange-AntiSpam-MessageData: iyqOVKKK9b/Z1MkJE7xulDYwM2Ksx1IK9X8ISEq7DWL0eU57TgdSxcNyVXsB+R3+j0G26huO+1UyNb97DlXEhrao2OxZ0fT3cIsp5rqHQDJebSB5ZZnAPsLjMbSWahNn4jKBWw07awJXU5FLHvBDqg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f24dbaa1-c112-49e1-f87c-08d93056043e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:44.8371 (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: DB8EUR05HT119 Subject: [FFmpeg-devel] [PATCH 25/54] avformat/mov: 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: oCdJIYGzu7fA By default, a demuxer's read_close function is not called automatically if an error happens when reading the header; instead it is up to the demuxer to clean up after itself in this case. The mov demuxer did this by calling its read_close function when it encountered some errors when reading the header. This commit changes this by setting the FF_FMT_INIT_CLEANUP flag so that mov_read_close() is automatically called when an error happens when reading the header. (Btw: mov_read_close() is not idempotent: Calling it twice is dangerouos, because MOVContext.frag_index.item will be av_freep'ed, yet MOVContext.frag_index.nb_items won't be reset. So the calls to mov_read_close() have to be removed before the switch to freeing generically.) Signed-off-by: Andreas Rheinhardt --- libavformat/mov.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 47a8e41236..2e061a55d1 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -7556,13 +7556,12 @@ static int mov_read_header(AVFormatContext *s) avio_seek(pb, 0, SEEK_SET); if ((err = mov_read_default(mov, pb, atom)) < 0) { av_log(s, AV_LOG_ERROR, "error reading header\n"); - goto fail; + return err; } } while ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mov->found_moov && !mov->moov_retry++); if (!mov->found_moov) { av_log(s, AV_LOG_ERROR, "moov atom not found\n"); - err = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb)); @@ -7616,7 +7615,7 @@ static int mov_read_header(AVFormatContext *s) } if (st->codecpar->codec_id == AV_CODEC_ID_DVD_SUBTITLE) { if ((err = mov_rewrite_dvd_sub_extradata(st)) < 0) - goto fail; + return err; } } if (mov->handbrake_version && @@ -7635,8 +7634,7 @@ static int mov_read_header(AVFormatContext *s) if (sc->data_size > INT64_MAX / sc->time_scale / 8) { av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation %"PRId64" * 8 * %d\n", sc->data_size, sc->time_scale); - err = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / st->duration; } @@ -7651,8 +7649,7 @@ static int mov_read_header(AVFormatContext *s) if (sc->data_size > INT64_MAX / sc->time_scale / 8) { av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation %"PRId64" * 8 * %d\n", sc->data_size, sc->time_scale); - err = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / sc->duration_for_fps; @@ -7676,14 +7673,14 @@ static int mov_read_header(AVFormatContext *s) case AVMEDIA_TYPE_AUDIO: err = ff_replaygain_export(st, s->metadata); if (err < 0) - goto fail; + return err; break; case AVMEDIA_TYPE_VIDEO: if (sc->display_matrix) { err = av_stream_add_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, (uint8_t*)sc->display_matrix, sizeof(int32_t) * 9); if (err < 0) - goto fail; + return err; sc->display_matrix = NULL; } @@ -7692,7 +7689,7 @@ static int mov_read_header(AVFormatContext *s) (uint8_t *)sc->stereo3d, sizeof(*sc->stereo3d)); if (err < 0) - goto fail; + return err; sc->stereo3d = NULL; } @@ -7701,7 +7698,7 @@ static int mov_read_header(AVFormatContext *s) (uint8_t *)sc->spherical, sc->spherical_size); if (err < 0) - goto fail; + return err; sc->spherical = NULL; } @@ -7710,7 +7707,7 @@ static int mov_read_header(AVFormatContext *s) (uint8_t *)sc->mastering, sizeof(*sc->mastering)); if (err < 0) - goto fail; + return err; sc->mastering = NULL; } @@ -7719,7 +7716,7 @@ static int mov_read_header(AVFormatContext *s) (uint8_t *)sc->coll, sc->coll_size); if (err < 0) - goto fail; + return err; sc->coll = NULL; } @@ -7733,9 +7730,6 @@ static int mov_read_header(AVFormatContext *s) mov->frag_index.item[i].headers_read = 1; return 0; -fail: - mov_read_close(s); - return err; } static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) @@ -8205,6 +8199,7 @@ const AVInputFormat ff_mov_demuxer = { .priv_class = &mov_class, .priv_data_size = sizeof(MOVContext), .extensions = "mov,mp4,m4a,3gp,3g2,mj2,psp,m4b,ism,ismv,isma,f4v", + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = mov_probe, .read_header = mov_read_header, .read_packet = mov_read_packet, From patchwork Tue Jun 15 23:32:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28340 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4312562iol; Tue, 15 Jun 2021 16:36:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmTn+cHjfSxF9libG7P/vdmhBvdalAuT3KETZi1kEj9/2Z2NM1BHcoRvR+VwNtlpw9+sQv X-Received: by 2002:a05:6402:6d1:: with SMTP id n17mr723145edy.116.1623800217302; Tue, 15 Jun 2021 16:36:57 -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 v11si307390edt.160.2021.06.15.16.36.57; Tue, 15 Jun 2021 16:36:57 -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=GORIchWz; 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 C09CF689D24; Wed, 16 Jun 2021 02:33:48 +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-am6eur05olkn2053.outbound.protection.outlook.com [40.92.91.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 18F14689B62 for ; Wed, 16 Jun 2021 02:33:47 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ir2HE8eBB5XzzgfCvq1rqyz0wco+Msj+2FSEYPy77Z32/aGLmVEVPq0FXuxoz/x5qesX792+kC5pZMxLq6BDjjAePfQplsk8mYZutUEpNxb76DW1s0ceXcpkF45eWFBHthQhk7wLug53KyxaLB1iyexDVCSlz75YHzB5q1lJ+GI5dLSlEJD5+cWFP+N6nT1qLfgnZFfTpItvAVHNffuvpqcaBaArjaW1sUX9MaWSdnKxv3+q2SCiCurWTaajkq7O3Ww8/0TA5NJOvHzPUGZrUtlyaXVqDhAwChCT5uy5EBRIrT9rZScVHymrznv4+c+tvega6tEpU/TA1Hsgq/52CQ== 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=USTK64Ttf+Wi5+3E7zoysH+SHkSGNOEzw/R3bFC0ypU=; b=Br5h6u5JrwtSSJIgMl3z7nOU8u+Rt1zDtZLOoezEHlCa95CfonBQo8+1Hd+Vpky4O7FN0nulSm37pwOuc4SEUYEn4NPY04xQZUMzm+YY+sKh5e3yemWwFHtWJSoIK51iSgQoKLbumbKLhfurmDC2aZ+6GYs8VGySfwwBqtT1AXr6QeWUEbEF5iJMIaxyYMNwBstsjqZHfDd/WQzIZ9OHgu47SpO73fveijwR4rbHPD8UZg8V//0lyVCrXlO9gT7rh1p0zx+E83Wyr4vr7AuFmmRI0Y8aN8Jy3NbQ1dsPWIl2vYQkJJaczrHb/4MGydLLWBDgeH5XkS0ZAvIeYKlRGw== 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=USTK64Ttf+Wi5+3E7zoysH+SHkSGNOEzw/R3bFC0ypU=; b=GORIchWzoHzhOSM7Tw5RPZb4ImHU1h5E6vdVYJI2iGHJJAiYzJmkhyPK0/lIs+engf9E2jIkvxQ7ZYTuOIOyhLZrogLSHrNRWkGpxYPmMnUZbokwclnFc5Uvqmb/V9OSwovzUT5ashNzl63xxZ+YeREnQw1fRtmLDLEtz2VCaWSc3RwY3lnkFSPKDU/ijKnL5gL+2GA4AD+/SnJv8hr32ek0y2PRu6y+Ay+MW0yiwaPpgEcqW7WwlB9C9UtHlUDfhlOXh/EyqD+3iNI90qnbiDIv7p9GO+9zfWAs6l+AKUXlsh0+Hb308qQKa14ERgevoa1asDw8KQLDIjk3AVQO+Q== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::43) by DB8EUR05HT203.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::295) 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:46 +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:33:46 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:B6CE0B434842CE24CF9B3D57423B677C76868D396B5F530DE8201E44E79563F9; UpperCasedChecksum:6DE85D838D315CECB8F3D98E4CB887D3BE847E7293B9AE0C2311FA0CC9DD6F19; SizeAsReceived:7600; 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:46 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:15 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [YdF9foSEw4DlNyWS+n2M6maVBvwNkx0H] 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-25-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:45 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 9253fe47-7450-4b48-4bd7-08d930560511 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pYMm1Meuu1YSOko0ABnDwaDlb2CMfBnLzYVv1xYf3/S1YQoi1D81A/RSID3GBnnVin+Ednqbyl0Eni+ZWngG8Hub0Eo5JeIhWSf04Xq65CNDX5T543cNpLHgMos8MdXsrkI44+S7KpZaFd7tL+UWHTib6WaduC1RhLNObrZ1h9a8QOmSkeSdaX/ed74o0/ngbVj3FPUB+ydi7rAiICett8cIntAHKqbr4NRUNO54gLs58OkUr15QQNy1BGbz8aOG4l7dST8zrqNj0Cy0TKriYRhiZZgnPom9x92m4iyMQN1btK+ZBaxAqcz0TA5uGtk5f/iLTrAwvyadIvL0Xm8xzcLCY2BijekxS3XstHUiLSxqhf/qhl817ebdplqs3a33d/mTEZIjekXLsDha5MgzbBdnQhVTjS3AP8vfSF3wnYqyrzIgrWVYTkyoURiZttW3O+dA+BwZ3W08OUSFUH29U6tsZTVa/WAPEOXIuLy3KKfqgN5ni15UYoLXNn+LsoLSGDw2Y4CgS6Sf+CLt7KSeoA5/SHAXCAOR5uJaWOWHAb7yQxlRIFnnF6DMvF6D6rGOC5JVTDBfhDjFTYFcQynbjDq8OqQpkfn/ljXuumYF7xNm/fPiGgDtXqibp/Ws7jJKVPUBIsJBkRLWsyEvrE4Zw4n+0ov/HwShWfopSqpCDm8UBtSicSz9vWFvPmzFycCwIqvdgZ92XXvvGgawPMiE/umjLyBNV0RHBSNL7LDwlsXc= X-MS-TrafficTypeDiagnostic: DB8EUR05HT203: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +gMbPC6cG5F/j4jGskyVLOVexTIUvrCqfJopfkhpKaqjMojvJ1oADska9iEy8L/sXLGtRNBLuU9ZjJ3dXdexkEZvVf7lqvb88SGt12oehnCWMTkcQLJ0SW6UOLiNjokArHJLQL98h1jZfS4Jlqq+ZXMFcG2cj/YOLucvenARTWJppB0wKGBKYj6Zdj1QIgip/jjH1MB2REG5oxYM8Af4poMDZVfLd+vaphzW1N1cMXUjbxFYjN/uckg4i0bTKxrM4y9QBjnqAffObOvNVd7m4dWGuQmkNHlg7R+mXLs+vfT+u3UWLdHRRTgvrpxPSCHxUP9Q7CZXXtdHY5KWwKS2GaW8uvS/d0dFywACUBByS+eUb/a+kwncVcT0ZVkRUdQxNPulOrzDdcObubRQ/VPbBg== X-MS-Exchange-AntiSpam-MessageData: Uuy/504xzQ3s4upFASoI41SidAFrP7SuwmdWnG21SizJPKlM8lG0KCkJqextOgungBCmW0a2rIPQRlII9snmHGYgVXJyVSZ6LLNHeiAc5XaybTtq3dUi4BvMc6TO47PFLCVusbLN5sUizSe4Yu9MWA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9253fe47-7450-4b48-4bd7-08d930560511 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:46.2325 (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: DB8EUR05HT203 Subject: [FFmpeg-devel] [PATCH 26/54] avformat/mpeg: Simplify cleanup after reading vobsub header fails 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: DUhHD4Rj7F8i by setting the FF_FMT_INIT_CLEANUP flag. Furthermore, also remove an unnecessary check for NULL before avformat_close_input(). Signed-off-by: Andreas Rheinhardt --- libavformat/mpeg.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 178e71d891..4b7493395d 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -723,8 +723,7 @@ static int vobsub_read_close(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) ff_subtitles_queue_clean(&vobsub->q[i]); - if (vobsub->sub_ctx) - avformat_close_input(&vobsub->sub_ctx); + avformat_close_input(&vobsub->sub_ctx); return 0; } @@ -768,17 +767,17 @@ static int vobsub_read_header(AVFormatContext *s) return AVERROR(ENOMEM); } - av_bprint_init(&header, 0, INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE); - if ((ret = ff_copy_whiteblacklists(vobsub->sub_ctx, s)) < 0) - goto end; + return ret; ret = avformat_open_input(&vobsub->sub_ctx, vobsub->sub_name, iformat, NULL); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Unable to open %s as MPEG subtitles\n", vobsub->sub_name); - goto end; + return ret; } + av_bprint_init(&header, 0, INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE); + while (!avio_feof(s->pb)) { char line[MAX_LINE_SIZE]; int len = ff_get_line(s->pb, line, sizeof(line)); @@ -911,8 +910,6 @@ static int vobsub_read_header(AVFormatContext *s) memcpy(par->extradata, header.str, header.len); } end: - if (ret < 0) - vobsub_read_close(s); av_bprint_finalize(&header, NULL); return ret; } @@ -1044,6 +1041,7 @@ const AVInputFormat ff_vobsub_demuxer = { .name = "vobsub", .long_name = NULL_IF_CONFIG_SMALL("VobSub subtitle format"), .priv_data_size = sizeof(VobSubDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = vobsub_probe, .read_header = vobsub_read_header, .read_packet = vobsub_read_packet, From patchwork Tue Jun 15 23:32:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28325 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4312681iol; Tue, 15 Jun 2021 16:37:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwF/SZCCfzorpUldU303DITd0kwaJYfQ0jBwyaJ4GmHMDTC4+2SZXLFDCrtwprCXrHvApoW X-Received: by 2002:a05:6402:3117:: with SMTP id dc23mr726117edb.246.1623800225891; Tue, 15 Jun 2021 16:37:05 -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 ba10si254275edb.344.2021.06.15.16.37.05; Tue, 15 Jun 2021 16:37:05 -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=uQCX5xEX; 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 D3697689D48; Wed, 16 Jun 2021 02:33:50 +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-db8eur05olkn2031.outbound.protection.outlook.com [40.92.89.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 66BC7689B43 for ; Wed, 16 Jun 2021 02:33:49 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kht0raIlMCd35vS+VzC3p/TtCpVb3xvGsGzRSIhIgQ27QECGrxmCExbm2sOfmnnVEr7fqz3xvafIa9VgD+bd5tT2lo9qZDVX8xC+zNe+kRpI33J9Z1w/aetQ/JvPcDnSolcEPz3Lq+j6KIHgYg6Da2Mmm7ZDB8+WvrK4A7NzieMHIUs4Z6cBaE/+LNnibVhxLu9RYwEeOpIoVfrMNlYA9wXL17opqSR+RJa8NP6q76UUrA3TcIAiPAwFfVina39rdQaMdEaIRLQDXFQBt69KVT9cXeUap/XvZySpMijvpK816jdSxUTqriTktk6DqMcHGvZbPSODeJL6xTZCkCVirw== 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=vtqKGTTjpUExnXhbxB9X7QbzMtTbuIOE4Rbayr5cSWY=; b=iRYRCe6YXWxR+zwjyAkPP9KLqUy8Aq9K8M2vUlUs+sWfwMagiWUmCm49h45kSldlU0EKLwqanXxF4sTli3QLfb4XbliQflzD5+5O3aE083bqIxX8k4x+OzduMf8fHFCu75pjQj4JRinkXEfqnj2ptdCB3CDB9v4s6TtiVcKHBk/U4oLApSYPE23dC2pgtdphP9X9ZiQkizmK6982iDYQhkazbsibjJ+E2xGVY1R2QivLCE7D5dz4poUIUWsWXjAxwo9IVpVbIjCofa+HL8aII78dcWTBG0W9zgfnGymUHH7HF0+cFT7AGnR7u1VQr2Y+cpgQ12KC8TIG4EbSCLcMBQ== 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=vtqKGTTjpUExnXhbxB9X7QbzMtTbuIOE4Rbayr5cSWY=; b=uQCX5xEX22+0ujFu+A+BW5HVk2V0E0eAcNZCBIficI+7NPKPTWZr7CZcXUT8kojrU1lHtuFnJGPa+TRhwTCuJ3vcYO1HLk/LVYAhwvq/yBBNbTkVu50w+4u1/UZWFas25E661hSrF3mPeX0kixl0dH5UROeCkOiHZpNQN+7zl1iYlorxvhhSFAV/Qd5BlcDWPQbBDu9WYeY0wlUpSasUoeeKiPKoHMRdTY7Ux6AR4PwOWzPxC0sWpCYO+86ZYJRLp4TUZu+tzbXfXQ3L8OVhF2C3i8qHqvyxzmOMddUsKLNjl26y1ekHi0VvRqct2ChXYNRDRJgIxFgwMR8uav+4rQ== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4b) by DB8EUR05HT099.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::244) 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:47 +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:33:47 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:5A3AA1F90FD41DCC6576E7AECEC6D1FD4384BE7E1A78D0F857BB6C087004B70B; UpperCasedChecksum:2122CB26F9A23B56B35DE17E3E3EB00282B27F079754E69D7E6BD08C5CFF36CC; SizeAsReceived:7595; 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:47 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:16 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [6ZuXaa61tzmMGdPs+SRdYN3yVKR2mgXx] 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-26-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:47 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 261934b6-eacb-4314-0fe6-08d9305605e6 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n7LELivV0hd92NH5vMhw8akfR5pzPkkTHXoE8SMoBVH7uUCbVezTyVCzeVrwvjRM1gRNAl/gEJVLkAY+jvfJXORKgicT/KuircKDZCfL/m1rK39eZrieszFctiSI8ZpR4TxmcMePxxyZztUbQQzFXz61FQQzUSaqHacFe8ZqEX+qSPyjSxUuao35LfuST4M5eFzQXwmzAXNePSpZ8zZhAvP7Eoci++hlw6spsevc2Pa3BJNqKaHTr1g2cgxHEXG/hYbvvRc1wO8RJqXUYBsgbgabT8Ww29CcH1+l129MgoF4RytzTwLx4AJoKNafmIqEHAg3zV3wbng4EI6Tc1uOMva0dKyZznI85rYgZg1VOlL7pR/2muhPWWSg4ILUcFSwbVyRXa+tC3snSi4xuWzYR2ssdumfA+fWTyh5VklVj36hxZwWpbXehk9XqL1OVBcX5GBz7PGtSabT61Rg7wqw/Njaiglzz6a7AcQTDiIp4qRCNcoPjBAVLKcih1cycrEHPpgjJvPQ2GkkS5CZDpVcgnASSDgzT8yjGnpQwjvHk1bTDJ3sD93HoVJjdziqfUhAFfQqGaBUi5zR2wETJjcgONYaZuI6JGjk+FHWLVftg2lLibN65GPdg55rhduF90PbWUVEMjP7jUCNxVZo3ao+SdLjfWhyciRjYoGWHH0dGQKlMPNuN7kAQQiLIXSMhTMaDStE7P0v3d+8iTPCOLVY3L/rfp95BzysLc= X-MS-TrafficTypeDiagnostic: DB8EUR05HT099: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3T9iUI9SdGtOj2hGp1zDe5+w471rT5sntdkSWx/njMnZWnKMl2QUQXXEMu7jwwwy0GgknMueA0SQwWEWICtLPBQRlowfICDXCz1L5vdaMaaCNjk+luiWyWWaH/fIHI28KFDZP0dA/2sujNfjKO1ZLXMWdZpk8X6bybvAdfu7PG3f8xCb6zWjtB55Xn/rBis7mhdi2jJaQdmNBp+hUoItrAPiRxKCDGIeRNp+zjUXL/C2vHsXzu7dTKS/n5gd/wzfpQYduDd5pv7iJ89r4+eH/jBVNRqf/tcZb7w3gwA2paahB6L4/KLdCJ58nhFupy1+2UpFhiJyxlgK5s7Yth8zteejJsDGvAH7S6g1+AyIEVr75fIHrLN9Y353xQF3Js8wEYVQuQp0vXU9qltuaZoiHA== X-MS-Exchange-AntiSpam-MessageData: Tlw7cLHkFbLbdcA2vgFjgfI+fvB55+SzQGPOnOCN8tofEbQAoEIuYygOIT7s4ht6zVvX2C6VWCZum2f+LJjLyx5k4I32H5U4wc8O52hp2QxttQZITtXWlldfNzPdqcRCx6LBV/ASszGLY9ae0rpE8w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 261934b6-eacb-4314-0fe6-08d9305605e6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:47.6568 (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: DB8EUR05HT099 Subject: [FFmpeg-devel] [PATCH 27/54] avformat/mpl2dec: 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: UtIjoggr+N0S by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/mpl2dec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c index b99acff157..0beb9ca388 100644 --- a/libavformat/mpl2dec.c +++ b/libavformat/mpl2dec.c @@ -110,10 +110,8 @@ static int mpl2_read_header(AVFormatContext *s) AVPacket *sub; sub = ff_subtitles_queue_insert(&mpl2->q, p, strlen(p), 0); - if (!sub) { - ff_subtitles_queue_clean(&mpl2->q); + if (!sub) return AVERROR(ENOMEM); - } sub->pos = pos; sub->pts = pts_start; sub->duration = duration; @@ -149,6 +147,7 @@ const AVInputFormat ff_mpl2_demuxer = { .name = "mpl2", .long_name = NULL_IF_CONFIG_SMALL("MPL2 subtitles"), .priv_data_size = sizeof(MPL2Context), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = mpl2_probe, .read_header = mpl2_read_header, .read_packet = mpl2_read_packet, From patchwork Tue Jun 15 23:32:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28328 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4312794iol; Tue, 15 Jun 2021 16:37:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjwLVtRpm+MwkGnYhSKRJWGSfhMHQcCaQEWPXx9Hl6DgIWO/yPGOR64GkcKz+iGA6RhhxZ X-Received: by 2002:a17:906:7842:: with SMTP id p2mr1936770ejm.487.1623800234707; Tue, 15 Jun 2021 16:37:14 -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 yd12si430268ejb.356.2021.06.15.16.37.14; Tue, 15 Jun 2021 16:37:14 -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=EWVr9kQP; 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 B799A689D7B; Wed, 16 Jun 2021 02:33:53 +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-db8eur05olkn2045.outbound.protection.outlook.com [40.92.89.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9471A689D48 for ; Wed, 16 Jun 2021 02:33:50 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FXP6X13+aZZsvBxM+mW0OH23mgShotwHB3ZDzpjVqlVQZUkkMatGgLXggPB70LjfC8P/WjLALroFT8psSzM66mNiwPt0D3okdtNm/kQx4MM90fG4wJMQCSA3gbcvjhgG5j+5kdolFmSTdWDMDHMq1sdONZEBMHozkOztwtPu3YMR6UiATIP0NL9id3dvXMxYzbolkUTHDEDqFLrskE2/7wwYBGWuMXcLXatwK/qGQQbMfJDUFyu3lcqdz9ZcXEnGwB/vVsNrebKoipbRI5WR7Vpn/6gPkEjgGEjttT8YiBlICQPSjt1EC7wEUPjDhM1QWMxZl0G5Y6mh5YTUZ4kgBA== 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=C8O7K1975ekHnW8dBWSwjppqbAk494Y1kncQypPiX/8=; b=enb2zqU0R9YYpPrXMEy20bIPi4TJ+1g5Ly/seAJ41+eW3/+8O2/IQsfO5WTHQ6teWXkJEMR01agn/SPJWA3Gx2CmORcq0CgPZO/8c1Mkh/WHrsAxb1Qx0uRvplwKL+bDdrFxShYESC/lSTdhyKJzmiEFiJYz2SfKk7CT8487jDPdd2bKfvdC/dBoq6s5NF6UkqKMhpHALDiMmE0f+Fv//XuJLM3v0DvfUHs6RqZLgeRsRy/nFds2r49aQMBUK8gl9K8uZ8oRK8iKp56CNKha9bK4Z7HoUkWkCXnU2pv4njDILECsmzUvKXtB1aA5A61mcp/M+MK+ZFVwZ1yEiCaHaw== 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=C8O7K1975ekHnW8dBWSwjppqbAk494Y1kncQypPiX/8=; b=EWVr9kQP8lGA7lgEcJ0dKKw2Je7U57Gsy6Z9ZVnBarkaoS4A9ZAGaB9Fup32jSOOgktwoHN7pzbT4iiMjBGfeZBK/Gj+mW6vf2gCUeOYHQTwVRdCiF/cb1cUB7dbgi3ZMYEGR9FynGbM3hHFn0LN5GCYryMvJsbDpF+RNdxj9Jo1PGbRZGjs5xBmt5BWaxIuJmJ2c5YOXUjvsv7xjOgfSEvze6vBOtKKcGmS3yuirULd1dZEe6wdzeYp2zrlyD5A3P13yVNNwzI+68JR0cEB0QgWIonpTPUjjXuaxQq4PPOjNDGDzHBaH5ayp2pb/pnne7UvK2Z2Svrl1wRf81gASQ== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::49) by DB8EUR05HT222.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::416) 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:49 +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:33:48 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:60F23BE93A7A05D1C78E65F410FF323E66FD3B3192EE21CE2EDB9FE4206EF1C9; UpperCasedChecksum:9481C528F1F510E6360D01C33C48B4BD8CDE79E8E9B1AFDDDBFE794123D76F2D; SizeAsReceived:7596; 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:48 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:17 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [kidCm5eLWQ0px+njqQ2ymAaszVYo6CxY] 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-27-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:48 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 1e7c1fa9-438d-4c63-6029-08d930560696 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n4p9PDP/HNk3ukaMkcBvK/U2/MVwz7AXwc1xVgo2WzRxPr8Q0ldTeSBOlP6lipmFRI3IIWGXzU+5S9UgbrXG/TWxbQON1zmrqKTFkyhzEekG9bjpvqsyIl2+r8PjW0aHxluh2tm/eASUNzzQZ4lmg/fG+ZlZuxSwVMogEPxByMcxOxSUVXQKjwesd+TNE0K63EarNwcQezF1bnntFgyJr0ejQZlYeREPahT4/Z5VVoT5DPb8Fm6Hm4MuM6vdYhuSg2/y9UaAVj0jMOANqK07Ja9nOnNUrSONSOVpw/DJnp+Epsf1piJilHTAETrKQdmC5u+8RfQ6axLYz7KTETCfruSHzIHfUGwq1CzdUIEjci5hHikqTL7N6V1pMXROv+v1XAmFKwVTnidhWQPGRHJBVvFtGmV2ZbdYgcCIko+m91ZbrQ91BNTjENAveFLpV+ER8+4BTn8pRONHGsyVDAzPEeBLTUdWyrN20EKkxR31jh7bOezHmYhVjxFq84XuJLAuqXFMwOYTxgdb88D+LELI6psjsFd8Mtm5B3T5gYlO576RjL2p+DDpGDAUfA35WUqNHOFp1WwaL6C0RDv0b4+0E5nwZf1VvnsDeqzzZWKTHHXpzgURVczULWtDP758E80tnyTZP8taEL4QpMvTbwZFWBORaiH73HEVe91HBYRlkVLsf5SApKPNjehKCZSoogIKwMRZskAgwcf+f7qSBqBhHivLUWDclICb/s= X-MS-TrafficTypeDiagnostic: DB8EUR05HT222: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EQUoVj0avSFLyp70SMwd8M5Bt0CmOuT/jIjuycEsekUfbi9JZpcwYCA58nSx08c7RKsnRZH4vBrIenECHdTiFWcf60K4AnxBfduo88GtkQR02DPJc73VSEAyqqWTWzp7HW2NowrPqDBdEoO7Pf+tBirYwToTL5lefDYc78bTQeh7gpGtFyInN7gabu7wyKCLFnB8CZR99lJAUCGGvtwnmi0ggJh1dw+AvKNfDYCb5gTBmF0ygTVV6AReTm1OA3H3t+IkN/ddgEvb7+584xaGn73KfsqVkt+FRJ5JB3/sMvTjgIMVglQB2VCcyJla6I9uL8xpWhsuoldWydxS0m3OWNHY5trxTJffcDALBd1Y+g+4Qzmr4yA9we4msBZUm6/2 X-MS-Exchange-AntiSpam-MessageData: X0Vd0tEiJ5O/8bu2eHgpqkhrXCcVGEiEOOdQuzrEe7sJVKQmnZ9jtB1oRW40quAGfZc7HvBZlbPAnTnpSiAGz4wu2H2gMj0SlFdjs0XfJqTT7NQVv/nQRYQsD5LtbRlG7JEGha4km8MHNgTh+rB68Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e7c1fa9-438d-4c63-6029-08d930560696 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:48.7983 (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: DB8EUR05HT222 Subject: [FFmpeg-devel] [PATCH 28/54] avformat/mpsubdec: 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: QGoiQeka1RF+ by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/mpsubdec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavformat/mpsubdec.c b/libavformat/mpsubdec.c index ee53be17d6..abf0e7fb9a 100644 --- a/libavformat/mpsubdec.c +++ b/libavformat/mpsubdec.c @@ -165,9 +165,6 @@ static int mpsub_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &mpsub->q); end: - if (res < 0) - ff_subtitles_queue_clean(&mpsub->q); - av_bprint_finalize(&buf, NULL); return res; } @@ -197,6 +194,7 @@ const AVInputFormat ff_mpsub_demuxer = { .name = "mpsub", .long_name = NULL_IF_CONFIG_SMALL("MPlayer subtitles"), .priv_data_size = sizeof(MPSubContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = mpsub_probe, .read_header = mpsub_read_header, .read_packet = mpsub_read_packet, From patchwork Tue Jun 15 23:32:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28406 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp124766ybk; Tue, 15 Jun 2021 16:37:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy24BQ/mReC8AON5gJJL7QoF2Cqr3IOLPTDr47+KV5KIJSx/pG07NODIZbuY8sVqshyFUEV X-Received: by 2002:a05:6402:4395:: with SMTP id o21mr689071edc.163.1623800240846; Tue, 15 Jun 2021 16:37:20 -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 v11si308625edt.160.2021.06.15.16.37.20; Tue, 15 Jun 2021 16:37:20 -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=ojK1NT3g; 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 5584F689DD1; Wed, 16 Jun 2021 02:33:54 +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-am6eur05olkn2062.outbound.protection.outlook.com [40.92.91.62]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9AB52680454 for ; Wed, 16 Jun 2021 02:33:51 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RZXLTKmojoPZHqetSB1sTMe4EpSFC/4VyogAsyl0V8R8On62t6A4mRDX6KMhpT3xj3yAcuZLRbXHxMt/PZSexF4OY6kzm+dTXKobOUseai0ZS1qCU6RDIJFlwtFww2aVVV3gG6LSZjxD29xDaz9VrxJrKj2f9xWN70uXIiPv7YmvoL3hKS/0u7v3p5g+qzP0XeNM4yQ8vC5AOGHbHKfBkgY3+9spcEfSvwPDGKMeBI4O3EgdaGjtQfZHaU3K0UGnfkmVEtjmWt5GNGszvSE2jw5c/Bx8/VOdj4Z0Cdp8WVnLyEh/znDU080WDAUIAyyXaTxqCJUiWGTpuDSXMPbZEA== 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=r4g3mDB5R7Vb8JkQNRE5oAcpCS9X5LSj8i8VKYmxYAE=; b=I3c8d9yJ9WA95feyPPqAux+GJxwGReXXcFydzNcnEMHXZYCJqVErSBB0sivz2vF3gIbj5hlVimEshwjtVsI+Ycnz/DRdfwuSO8fqu9R0WiazmkDeJpEatEEXriq88L1BzCa8AU865zSKYWPn+e/GiqsS4BR8oVYYA3Cj0s2bwmqWH8nIouUYQfbbtBRVxOQDmm9OXh1j3VMfNKGKRQakqZdGjp5wjlhPRCg23tOTE1nEPqj/F3tSNZW+dD61qejjTwTokB0PHQ775dF3bU7CxDN5gtMisAUYp4Ouav8ycvtjOVRZ6ClUNQ+sbgNkpc6w3SHzlaWLWA4C4lfeDcU5bg== 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=r4g3mDB5R7Vb8JkQNRE5oAcpCS9X5LSj8i8VKYmxYAE=; b=ojK1NT3ga3DMhvTxmZu1VEq6F9KkYqQa6ylJb4Zjzl63ZRjvlB1mzzbw1geTX+zyngzwwxQsaTchnGXblL+varetrTaicGkeCLtFQATe9cLgtZXN98NCmHQ6AgteasVOvcmWitNVmxLIQEm7KypqJALQDD3LgEMJx3ev50rl0IpRwgMgYOB4LgBzK9Y7WAzX3ptVtqkXKLJtTc0tSTdRgV7aeOgIvWacJ87JT2/R56wmJ96Cpnzl4AtklGnPPTh872b54DNn0lqfT0ykny4d/IM6ePtQkto4Qti8okg2OoMfUgu0CDISeRd2B850GTzmH28tgC1vePWE6RCHs8FsDQ== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::42) by DB8EUR05HT039.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::191) 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:50 +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:33:49 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:A24C29066DAF8DB9F9A8DC5A43AFA6FB2D4AF0FA043A694BF21AEA1B513353B7; UpperCasedChecksum:49B1C8770EE14D5E32017A534FA26B8DDB38E8A90717DDFA692A0CAD1C8F1CCC; SizeAsReceived:7585; 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:49 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:18 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [0H5Ur6YhAsS4KBWTqAQzvCQ4kV78/3hv] 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-28-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:49 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 3d39e392-47ad-4455-7404-08d93056073e X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pWhkGqqrkWQINYQnacuBy6NE6RX291zet4ZSf3ApatY08mcIOHf/dZKefm9vqDiJIQ70T/5H+2p+lYBYu67P+Y6JRlvFqjwtNvNDh2alsaWFbMOIgE4L2qH3NhTz84BU3wluk4fq914RdvJyXfk9dpNyG7L1SwVmzccTPWdYlRM3ErFW0KR7Bx3+3t82IKn0mueqWlbe/sf7wbtROneK0obCJROxKDNhAgl7reevMqldhewyVH0QVpfdKXIRZrv57NSoWWaU//W67k7gfAoEGptEZT7tv2u0ZaM3p7/o5ox2Z5iQ31GMBaGaf3LfXJwQ+THx90F1ouHVpp3/qhWgWZBBZ+73hTvnJy1CZKg1RpjAgqLtNpoaX9ACA5NChlnFyW8XAtsxVr3UePMFm35t690SRxqsYWDeBfhJs77qZ2p0TLM89DdsHu1Fo3818Q5FwgJDvIAvXnKy0tx7CA57Fax8KDKAuBLQ8NX34ElqYoe6xCd/61KkKG2gcDg7YvRaCDyDXy/hG8eNZ0wi0QbwLaCeJdcQqrmVE3Qo5QpqsbnyoqemrfonUZaQwh3x8wF1LDl6Lr74/UASQ5jPGcE7KjM1d+t5/XkS2GwArBDRqnuGl8SWVZA23UBA27g4V2RL9x68WHBCR7DEYNA35GEUCwYPSuZs3bmgCayWrAcv364nd+fUc9MGlPAMDhfro+N8HtTzdg5ngj6AoFqNVgK2PlzCKJjig4T4v39mqPF0Odpg= X-MS-TrafficTypeDiagnostic: DB8EUR05HT039: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jS0dpsO475ZFQIXUDBfDxI5McoQ2pMGZgLBpnhOJm2yE+BMe01TycmD1zFHq2T+jc0qEI79puCdaIfMDFBLDR+I4fgukX+/sF19+oATJU1BwGWC4PFrEBcDS7VYYa4RlEmQLKbMNj02xrvbn+wKvOzsGzM3NlePGgm5b+9XM2hcoFXYcQyIv6Nska3z+BQpYKs2A8aF4jTEasXNhTi3bwcNMkO3f/9B4YDVrMaGckA1iFHQQ3BrElhTIzasEJ/VYYGyAl1mx2IOELXX0tyL2mhMH9eCWAp6/LpXnTboB4cJwgfy6P7ovetEWWIrMVZ+UE70oZbpyuHIiFG3eVsRfQyhml0Sv9UB4oCJHRo6b/qGnXQ6+AoQYBJrVnjDoPps5loNOEfENza91MwJ2VvsRXg== X-MS-Exchange-AntiSpam-MessageData: 4ZXOlyO13Znf4S/GSUjFM/qSc3AY0AP8TjsdQ8JYphLFTEbIsdzmrdZ1JXjmGco5RWVz4v4pvH18uRgzeTIpM+vI5jdH6KnRexQh7JnP966L/KHIliaJo9j1obP7/vxqUTCpMV6z5hgyuyGcmF51aw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d39e392-47ad-4455-7404-08d93056073e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:49.8569 (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: DB8EUR05HT039 Subject: [FFmpeg-devel] [PATCH 29/54] avformat/mxfdec: 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: IoIhuwFMKyyl Content-Length: 4403 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/mxfdec.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 7b40076fb4..16f5052452 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -313,8 +313,6 @@ typedef struct MXFMetadataReadTableEntry { enum MXFMetadataSetType type; } MXFMetadataReadTableEntry; -static int mxf_read_close(AVFormatContext *s); - /* partial keys to match */ static const uint8_t mxf_header_partition_pack_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 }; static const uint8_t mxf_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 }; @@ -3343,7 +3341,6 @@ static int mxf_read_header(AVFormatContext *s) if (!mxf_read_sync(s->pb, mxf_header_partition_pack_key, 14)) { av_log(s, AV_LOG_ERROR, "could not find header partition pack key\n"); - //goto fail should not be needed as no metadata sets will have been parsed yet return AVERROR_INVALIDDATA; } avio_seek(s->pb, -14, SEEK_CUR); @@ -3374,8 +3371,7 @@ static int mxf_read_header(AVFormatContext *s) if (!mxf->current_partition) { av_log(mxf->fc, AV_LOG_ERROR, "found essence prior to first PartitionPack\n"); - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } if (!mxf->current_partition->first_essence_klv.offset) @@ -3400,7 +3396,7 @@ static int mxf_read_header(AVFormatContext *s) for (metadata = mxf_metadata_read_table; metadata->read; metadata++) { if (IS_KLV_KEY(klv.key, metadata->key)) { if ((ret = mxf_parse_klv(mxf, klv, metadata->read, metadata->ctx_size, metadata->type)) < 0) - goto fail; + return ret; break; } } @@ -3413,21 +3409,20 @@ static int mxf_read_header(AVFormatContext *s) /* FIXME avoid seek */ if (!essence_offset) { av_log(s, AV_LOG_ERROR, "no essence\n"); - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } avio_seek(s->pb, essence_offset, SEEK_SET); /* we need to do this before computing the index tables * to be able to fill in zero IndexDurations with st->duration */ if ((ret = mxf_parse_structural_metadata(mxf)) < 0) - goto fail; + return ret; for (int i = 0; i < s->nb_streams; i++) mxf_handle_missing_index_segment(mxf, s->streams[i]); if ((ret = mxf_compute_index_tables(mxf)) < 0) - goto fail; + return ret; if (mxf->nb_index_tables > 1) { /* TODO: look up which IndexSID to use via EssenceContainerData */ @@ -3435,8 +3430,7 @@ static int mxf_read_header(AVFormatContext *s) mxf->nb_index_tables, mxf->index_tables[0].index_sid); } else if (mxf->nb_index_tables == 0 && mxf->op == OPAtom && (s->error_recognition & AV_EF_EXPLODE)) { av_log(mxf->fc, AV_LOG_ERROR, "cannot demux OPAtom without an index\n"); - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } mxf_compute_essence_containers(s); @@ -3445,10 +3439,6 @@ static int mxf_read_header(AVFormatContext *s) mxf_compute_edit_units_per_packet(mxf, s->streams[i]); return 0; -fail: - mxf_read_close(s); - - return ret; } /* Get the edit unit of the next packet from current_offset in a track. The returned edit unit can be original_duration as well! */ @@ -3916,6 +3906,7 @@ const AVInputFormat ff_mxf_demuxer = { .long_name = NULL_IF_CONFIG_SMALL("MXF (Material eXchange Format)"), .flags = AVFMT_SEEK_TO_PTS, .priv_data_size = sizeof(MXFContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = mxf_probe, .read_header = mxf_read_header, .read_packet = mxf_read_packet, From patchwork Tue Jun 15 23:32:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28344 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4312977iol; Tue, 15 Jun 2021 16:37:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEu/gb0md1K8jgeDptkTHGvyykZC4p5bi6JT4S4183/Xq5KbNtLlPHy+nSqYhAITPKDb5b X-Received: by 2002:a17:906:7fc5:: with SMTP id r5mr2141545ejs.474.1623800253334; Tue, 15 Jun 2021 16:37:33 -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 v9si275321edc.545.2021.06.15.16.37.33; Tue, 15 Jun 2021 16:37:33 -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=NXYeipSI; 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 615306883BF; Wed, 16 Jun 2021 02:33:55 +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-am6eur05olkn2011.outbound.protection.outlook.com [40.92.91.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EF217680454 for ; Wed, 16 Jun 2021 02:33:51 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cqzvsitvr2NdKPf9YNvMY2CtM8CogQNCofHdiofmVojiRefZS25RxnuinpAOCOywg6vyB96N86D7NthmH3E2S+7q2LmkeDf6xwTpiutx+g2gpD4DUPKdti4Kq/lrT/eQK0dkodenaqxRzSBfZn9IenMXKI+CRVRSXDepB6NJxYmmK3vWrM1RtFwdGO2aB9bfAIZ0nxjharY5oxroApy3u75Lmav9v/EF7YFFpCL6eeehm3waN4fgvFeZfxf+15cmGwVw9McUm6+i4ramP1nQu1F0B1eUVDTQM7Am07JWXl1DIDLAep71XR2PHQS/3GyW3L0qBM0NIvgDuljnom7TYQ== 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=RxsNh1ZQgzzYqqd9hfWhqYmrTxJbVVLJohaE4lcSxSs=; b=iYjhhHi5c5duElWPFxsyQEooySQv0kBXwaZBc147f24WLTNZuFPyZ8WsL82+frqRef+OQBnRV+TXYjMT99jp5sapoRpsbtfvW1tACShbqkzOWiaps3vmYh1Ycq3OvXLGhJWICs52mzLNlpvpzv78isTec3jPmQTU/lMtA8u84HPnCRs6f7Co5WGAn+sBh2F26u/zyPIbieLXtCb6Mz9ZTnltLFUc1EVNOQQi13W8UaFdNIMnAhqnz9i/K+ER7WW1LlioRR8LbYREP+HCLHWipE7oVgfSJcyeJEDIOYGG6fmhCdZSA6yoI26IHiy/PheGz49hEzOd/kUkVChNRKYeow== 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=RxsNh1ZQgzzYqqd9hfWhqYmrTxJbVVLJohaE4lcSxSs=; b=NXYeipSI2qLyw/EtYXp8Y3Ql7kwtuwe4ui2fBb7Gh3qqpr/L9WWUEMRpb2in9xvG4lzj6ZYrt+uBxrUAr2glSyUHtqnjB4UnZjTMJ/CtK4gSYkIpyKa3i2omYst2BiQugRJB1uqzZhfMkB1iju+klQ8W2pDp5vPxCvy7DcyNKEb9MstVHJIxpVzPOSREImamg4CFz4QLRJITCOw3zdZJI5SgQC4IcA/TTgMXEdLzDSWHX6GLUKRzmCoRbLxI/qGAILroOvKzGViE0DZJWga/Ic21w/I+BlGaRoy/XuJmnAzU1Q1QD16C6adIRhJ4fkSyKAclCj/PuDCcGUv5cJIXEw== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::49) by DB8EUR05HT222.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::416) 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:51 +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:33:51 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:0DE990E3ADCCA53E29AECA8B3B5535C9C25742EFA34DA0FB33DFBA29C0FEE953; UpperCasedChecksum:9F0A4D36D6A14AE580536312AF4C9E34D54398BE45B48BF0FDD2C63CB577D54F; SizeAsReceived:7593; 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:51 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:19 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [MrZYhcXlcG7y0ivTWXepoK2SWPqaMr1/] 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-29-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:50 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: b8af448e-ba9a-4d4c-5742-08d9305607fc X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pWhkGqqrkWQJ/G2nBDhW1VlqXp5I54p9b7loWHOASiARZpLAABfZ/OlKQ654gE5X41iBPW6EwSi80RUlYfwCc2KJ9WcNmHwZ/Uc1nCcp04GnaPCiZ1hSVXXK7vFVpOBAhecFK4sWHaHN3S2+IpV23iAbL3nZWvwd0TGuZ1OvHgLns2iHy+fxZaZU32Y2NUr93gXdq1qyTEubMJS6H1zZ50eYwxFzpWygU13H/6qzqUPhfpdnTHX3tbDzXcS8lhg34Ke0U6uBlpWInnEbb8rXEBp1dgJGjsRyHBiCag1ckMy48mrMIGJEwkQINgnil926BJYX9oJcLkMcXL9OH3rA0hhaFVnso8U+kENSGnyCGwSTEPTN1G//LVhnss3SRRReB09rB+60E28a3YosC5xM5mGUOaNka7We2xh88KIhNvRR+nDF8Xd2mXZjkpneEM6EP5RoVfDLeQxY5U6zpHxm0hWM+zTbt8G0mA8a7gNl6UndV5iX5NxH9xsdUT2snvK6N9wDKm49JQ11u4NwyECCwE+Il0Y96EU5CW4ZJjhitRNqVx6dA3kv/LxiSRL/QPjFx99QukWKe7osh6NhWfRhiB8To71WEHYI7WldTIpVjVyniLSDKds7oA1m0mQQ3pepjDBnw5i9UaH+MmOQcBmra423JxG/WHM025e5NJN5aDrja9QNamvWV6vm1Yyac6Ey2CIqXTpyBbKHndPMVON56u3jXURoxuLVTUYxTx1DgZgE= X-MS-TrafficTypeDiagnostic: DB8EUR05HT222: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qZh5B5yS7hvcwuAz1jVOPcljCjmMs4PSmS2/cz3RzSP66bZ6g5H59e0Ul1AbrBQfDQTDB7S7wd8NQDYg1bDbxKLgw8XBQjq1M5tRJQNW86FPsW7+yHY4ZlfIG6M6bpHHXNFy1Y4Rj94Wh20k0TjLbLLF6Mgwz1PxiahmQp5QWY1fF73Ecj/XFHHKtiY+ahxrvUETUYyaai7UUWLjnPMdbRdhLU8JtIhE24gbvJH9c6WdwproJ4eIhvi4SzOs8pl6LaxMRz4RWw9XelKpyi3daZScJ4oUIk7twmTRW3w8esccUTHDtwL6LiQm37ZtPlI3hDgahTnnXYg7DZIy8ik4PWGOdzuBOizI2DRBOtS7OWX3Gi12MoxJXOlNKDi857vhGs4UCsx8PYrWtVdd6r1O2A== X-MS-Exchange-AntiSpam-MessageData: pYiVIPETlE62KsZW4iLrGlbgdxh0zC4BIB3Tfktdn2SqJ4JEuwM3Jsj5lVKgVjrkHgw/ng47ctmLz7Pb207g3Sul9dxBp1A8RLMzC6AIjOh+p18vrdC6Yj5NRMCV9xQrMn40XOtinrbgTTccaWxvhA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8af448e-ba9a-4d4c-5742-08d9305607fc X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:51.1563 (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: DB8EUR05HT222 Subject: [FFmpeg-devel] [PATCH 30/54] avformat/nsvdec: 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: oXQxjG/F88J2 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/nsvdec.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 7dcc218546..ec73cb7f48 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -211,7 +211,6 @@ static const AVCodecTag nsv_codec_audio_tags[] = { //static int nsv_load_index(AVFormatContext *s); static int nsv_read_chunk(AVFormatContext *s, int fill_header); -static int nsv_read_close(AVFormatContext *s); /* try to find something we recognize, and set the state accordingly */ static int nsv_resync(AVFormatContext *s) @@ -495,30 +494,25 @@ static int nsv_read_header(AVFormatContext *s) for (i = 0; i < NSV_MAX_RESYNC_TRIES; i++) { err = nsv_resync(s); if (err < 0) - goto fail; + return err; if (nsv->state == NSV_FOUND_NSVF) { err = nsv_parse_NSVf_header(s); if (err < 0) - goto fail; + return err; } /* we need the first NSVs also... */ if (nsv->state == NSV_FOUND_NSVS) { err = nsv_parse_NSVs_header(s); if (err < 0) - goto fail; + return err; break; /* we just want the first one */ } } - if (s->nb_streams < 1) { /* no luck so far */ - err = AVERROR_INVALIDDATA; - goto fail; - } + if (s->nb_streams < 1) /* no luck so far */ + return AVERROR_INVALIDDATA; /* now read the first chunk, so we can attempt to decode more info */ err = nsv_read_chunk(s, 1); -fail: - if (err < 0) - nsv_read_close(s); av_log(s, AV_LOG_TRACE, "parsed header\n"); return err; @@ -738,6 +732,7 @@ const AVInputFormat ff_nsv_demuxer = { .name = "nsv", .long_name = NULL_IF_CONFIG_SMALL("Nullsoft Streaming Video"), .priv_data_size = sizeof(NSVContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = nsv_probe, .read_header = nsv_read_header, .read_packet = nsv_read_packet, From patchwork Tue Jun 15 23:32:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28331 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4313051iol; Tue, 15 Jun 2021 16:37:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMEuPCO8IqD/fQK53Bd9lNwHSnQqJP3/DWWwiwCeW7yeP4ogfm1r9DLtMYVMCT24gkt1Q1 X-Received: by 2002:a05:6402:1559:: with SMTP id p25mr684208edx.343.1623800261890; Tue, 15 Jun 2021 16:37:41 -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 c11si322972edy.202.2021.06.15.16.37.41; Tue, 15 Jun 2021 16:37:41 -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=K1z+Uc9U; 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 4A04F689DB3; Wed, 16 Jun 2021 02:33:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2021.outbound.protection.outlook.com [40.92.90.21]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 09DC9680454 for ; Wed, 16 Jun 2021 02:33:53 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FBgr35Eh3nCvzvmChhZUVzo9jLC+8SgIAtebqD2Dggf6Mh4MW+jYLVWV4eLWPwEdErPESaeL25blR9nehN3RG/ZQJS8OO5asKD3lsk4noh1LH35F4n4+3RB4MGHt9VqYnH4fkpSbZKuUlDT27RvH+2XVxeKl0/2+yoBBpvxqDeM2dyuVYAQjJkWoRuzZqMOTakHiQbKW63IqHqTy+iduIdsZDt/T3S5W6mZan1ee+NpF+KFHROqy16nj/n4HfFXm3/QWOeslhFgcd/97XOdPtbmmnITbj0HITAdVAukcxULvIHnowWxUlr/6pK1ppQDmFy5tCIvkQW9t61nPzRtpEw== 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=VgfKLtpD4Cs6Ea2KqAztPDB824LCASp9aIxH4/RnCEM=; b=gu6a2BlA20NjT/g1wV5kKKEfL8aYHfh2a/sFC7URcABv5ZR12LOrGaf6yXsL5FKGK+vxuokg2v+lkGncEohblBa64MtRykNv8gpXncidL4Cv/Zj9pQVeP2/0Ruup+5kuwPGn8QDZ069BMMydImfnDFApGaTYgcrk2Db2AVEFFnoJj1e2W9aWX5pxiP0D9TTxwF0G2fADJPW5u/84axf8DgqUWRd9Xbu5fazb5cExf7Jvh/1dVZpILkM0/budvOTNmjVzOZL1w/h9atfp+Y5xBsOaihw0yRzYUqbIyAa+r1ePf2oBzAD1/N/mLyQHchRN2qxe1+2YPXu+dtwW5TU+vg== 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=VgfKLtpD4Cs6Ea2KqAztPDB824LCASp9aIxH4/RnCEM=; b=K1z+Uc9UF620Y0YHvOLIES1wRZBonmW/QuYKuUazl0ta/w0pUFZnFu6rewZnILAIYwjzv9RcDyXVeEL4+FuUSOlNS99UjesQEdIsGeGvLr+VqdAQwYPUn5j9WpVxEo2BIpqx6GdI6HacB0sbDMmR1iqgFeKtlrsIs7hvNzqMOQbTG6+eYnrmSnDXd7uliYh/H/0vOzsHQHiWbq3c/begpibtMJ44hGiiE5U0rifb86vpLnCW5E6EXG4rDMuHPEPn7lywbs/j3EVbzKAYEHVT9xeoiRBvAAawQdD1gH9LyQxypeE4hSAjWbs7uqBUyFJSjqNTAnFkLu8VBQF8/N7aTA== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::41) by DB8EUR05HT128.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::170) 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:52 +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:33:52 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:B3D6A924CD6DAAF9040A3E02947F826C93BB6A5A87DEA363EEFC8487B6C26CDF; UpperCasedChecksum:25F8F25544089610489AECC51733337ED5949A424BBA8E20C5FD581F5C16A152; SizeAsReceived:7594; 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:52 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:20 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [jjQBFNsnUZRmhgpA22e/hHo/+0zZf/CG] 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-30-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:51 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 72efb3e3-5d71-459c-d25c-08d9305608bc X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjMDyua2eyp8bVC8Z6JK7zCONVCxtLC5GYiegmIg63jH+Z1O+Mn+JGucOEjEPYPLGjyabz2cCrdPgq6qeTnP0qd3kE4F2kzcD4Y8ow1mqPVpQiuS0eDfmYRfO+M7doLlT+U4qllgzUDzVhXR0pwMzkb9ogA11jLEzjsIEs3fR5+oNjJpA2qv/HZ4EKlZGYOvGvbu9BUn8/rGB7PEVXV//JdV7G0vvZFMweeM4yomjWTEL7g4KdVoa6lP7VShIooVllZ3e96RAFzQOLMy256/gs8gYe/O6I0tXlVXENqgTJt8e3WlLBmqgiV3+TITULqGwzhS0zh0TQgHki71ni3sQOHT/31tcR5hjojPeYQvU/5B9ntlY50IxjExsvp2YA5OYW//uxAAXjaqV3itig81bKmAcqr8vqo3PIGuPfurjQ8uPw84n3xu29odIwoc+8jzgaegrvT3P0IoZLBET2rLx82C/Sdziw2TVe3O/MsaT2KzZQtnYEYZxkShqPiO+qtSXVgN+MJ1DQEIkUxUhHYhQw1viSVjwLiKOz55pzQE8lXSmXSWUSB1F88O4K9L2dtKCjDSFiPoP6vB2WxcYMPMh32sDmf/NrNiR5Gq9QNtTCgwrTj7mGBcwN94JTzveAFt2pGjbWLNOVmlJD/J+RS9z06PX1QoN1H97hz0P+jW3Tz1oWQ7MMeIh6NB2/q1d119L9/JeTaslSp8Jd52Hx+wZe48= X-MS-TrafficTypeDiagnostic: DB8EUR05HT128: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n6pEpQtrkjOQCDMy8f1srhEsI+c+znA++4eK4rnZKSrBYYrtNBuBujGOGZd5cwt7x+tX/lYSiexI6EmcRZTuxB7/Uu308ppTsfbJyP4/gGcY4u5sfg0EpKLUmukE3/cgDxL+WLp+WuNJncW7Mozvmhvg8W1MTymK2vnCGlPXTM1yfrUDEDPUogB3AU6BZEUwrW4MoQx6+zDO2Pa7SJqVnuryNFpI2+IhB72D5vZkpZJ1tc8OA5XW8bN44/MXHvdqAERH3ktmnpzwT5Wn3TtrB1So3SyVA47d3ARrK3UAPGyNWEehbZ8hO+UqvuHTGchrKFZrPnYTEfyOoRxplIvuH6BrFhjmfbD7or8qFHngMA4DqY+cb3zgZVp5nSwtOlGUe/1c8PVrKtEC0EjkbUsXXA== X-MS-Exchange-AntiSpam-MessageData: Bfn+UuZ9wOCgZR24QnH/oTETS8sPU7yEvZjHJ95uypsBVRlwBoe3Usxj/u8Dl24TpGmVk2oaTGHILPXwYzm8nwDzg/vmVQGeheQXN9c9BRIMFEheOjXxZhDIT/xbAyu353oI2RoruF/9AqjShcVGRQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72efb3e3-5d71-459c-d25c-08d9305608bc X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:52.4327 (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: DB8EUR05HT128 Subject: [FFmpeg-devel] [PATCH 31/54] avformat/nutdec: 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: CWtWXWltZquD by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/nutdec.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index e709257135..0ddc552c21 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -805,7 +805,7 @@ static int nut_read_header(AVFormatContext *s) pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1; if (pos < 0 + 1) { av_log(s, AV_LOG_ERROR, "No main startcode found.\n"); - goto fail; + return AVERROR_INVALIDDATA; } } while (decode_main_header(nut) < 0); @@ -815,7 +815,7 @@ static int nut_read_header(AVFormatContext *s) pos = find_startcode(bc, STREAM_STARTCODE, pos) + 1; if (pos < 0 + 1) { av_log(s, AV_LOG_ERROR, "Not all stream headers found.\n"); - goto fail; + return AVERROR_INVALIDDATA; } if (decode_stream_header(nut) >= 0) initialized_stream_count++; @@ -829,7 +829,7 @@ static int nut_read_header(AVFormatContext *s) if (startcode == 0) { av_log(s, AV_LOG_ERROR, "EOF before video frames\n"); - goto fail; + return AVERROR_INVALIDDATA; } else if (startcode == SYNCPOINT_STARTCODE) { nut->next_startcode = startcode; break; @@ -852,11 +852,6 @@ static int nut_read_header(AVFormatContext *s) ff_metadata_conv_ctx(s, NULL, ff_nut_metadata_conv); return 0; - -fail: - nut_read_close(s); - - return AVERROR_INVALIDDATA; } static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int is_meta, int64_t maxpos) @@ -1297,6 +1292,7 @@ const AVInputFormat ff_nut_demuxer = { .long_name = NULL_IF_CONFIG_SMALL("NUT"), .flags = AVFMT_SEEK_TO_PTS, .priv_data_size = sizeof(NUTContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = nut_probe, .read_header = nut_read_header, .read_packet = nut_read_packet, From patchwork Tue Jun 15 23:32:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28332 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4313140iol; Tue, 15 Jun 2021 16:37:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0K02yuSpfzH/TGrctFCcyKwaoqD4vUaECKEJ9hiUsrd7gJnhGHLhkQursL5yauLLZf6z0 X-Received: by 2002:a17:907:1c13:: with SMTP id nc19mr2046493ejc.168.1623800270558; Tue, 15 Jun 2021 16:37:50 -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 g21si292286edb.13.2021.06.15.16.37.50; Tue, 15 Jun 2021 16:37:50 -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=kpkxd9k3; 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 47576689A2F; Wed, 16 Jun 2021 02:33:58 +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 74B94689A2F for ; Wed, 16 Jun 2021 02:33:55 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nN0Z7cvd4AL3F9NZSn7NZwoLaUXe1TxCM6BWSdPPhFEcUUezCfM3sQgEmEcqASura4W7d7qXngwdUFpHfmdyGGX1RSBWTGhkhIlBGFysCsZ9zQ6KOcvAQipMe0xzbD7vlxY7/0IeOFQd8ruw6x+1OYofybDHjL5CLaEkJn7g6lnSMi1Ke6/ktTNJSNPzyC6B8L8WuwsAmNPVSu48jg4Zw/GgSWgtKh8GAJUsDaA5dK7IWar48a3FmaRcR03LZnqZ6hqrq87lKfZz7x4C/ni/5BYAsp72NAu9OgycpAO5I8TgQHujt2wJJhVnFxCtjuk1siEvfJq62fnQpceKhF12mg== 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=BbtVG1G2U5Y3qjC9Ja+EGYdUH4jJoS0AWJYMPWrbn0E=; b=oRmm0TfN9nX1H/dHSeNzeUDAIQyoPJc/w440DOhMATbIQeObTbPtztn4kzxCoNa+a8zGm443wzY6eFMeIG5ATJAUS+wWoarvrRUQhjW9GDBTmyxCyQKRMFUXNXb9g7VBlOX9cG5M2pmc/wgGoCUWhVuzdreMggdgZNUaIKaAYfHvp3vo0AbbHArt4DC7/j4M3/FY1WZc4FRuHAqeHp4lV8K0uZQXhOT/g/AZ5838PHWjJHGHA/v28IpZCyE3w/K+CuIpfwFxlNs2GcEWGvUhEJhZQVz6cnsrdcqd0Fp9pln7WQz4h7RsyaB+V/AuUxQzooUthOLy6oW12OXh1ulhgg== 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=BbtVG1G2U5Y3qjC9Ja+EGYdUH4jJoS0AWJYMPWrbn0E=; b=kpkxd9k3tNEWlblWSor4au3diXpjGYRlX/5Fgt+rsobX0AuHRA678TSopcYjKgXKkBMKIdNDzyff92z1aBU/VepE8XlvkJtN84VhpF050TRwRSnV5zzI3amubIqxboIlKnovgY7a/AswyQOV70G/meD6OoAgB13C67LJ9gDrOZRBgEO0KpzxWWHbmw294lpr1RYw9mZrK7mHf3Lxf7EAWnGqD9HO5+6D9YwJYSAHhdaQ3GR31MP8lM0WJQx1QKGakQxmZWCw3b7pRqqZc8oJ311Dywoa/udiP07gLNkxwWowxJ3PdqVNJwBvo9BIch3KSNO62CJrg7TtE4ynmhVdcw== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::49) by DB8EUR05HT222.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::416) 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:53 +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:33:53 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:CBA4BF461D0C13E71A8D83529263063F070C97DED1F76F8CCFEE3DCCCDB2DC09; UpperCasedChecksum:A7608566F0DAE8B66516E200C76E2D9F54A59151E1AF620E8CE3A38EE69C0550; SizeAsReceived:7757; 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:33:53 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:21 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [zvceflYYse2Hbsbbx2xiQKkkteoQUrqv] 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-31-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:53 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f9678f18-466b-4c93-815c-08d930560980 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjMDyua2eyp8bVC8Z6JK7zCONVCxtLC5GYjNj+EQ2cZOsaynONbXc46J2mjnPDLqmkULS7CkUbetqNIEqZPNQPrr9jNKxHt96suqquMscmCsn8s5uyBIXuBU3Ab/3V8bOIkMEJ6Rjizv4SSCkhQqj2IdHsk5Eth/eJPUc+hYJzNsiHYeuYRzw29ZIhyzWomgDsfQGddaMw8BNsHJMvmjmSaDx5sy2StcOrnF/dLyhvka++DL24jZKU8OvrDrhcfN1RgXCgjQlWpY7cSF2RrI4BSgQL8aPGYa4Euy9FDZQAcoXSYezPIa/8G5SpBRt+DhrqwenuRODEQhbFSlXGZi0ZHcVGpx5qC0auAkmx2rsb9gih/UCRdF6qszOzlpMNYRVeO07UG08FaJB9QjMwb1UQk9ilts356F1S1WT1mbi4VfEl2+ez/18Z8UYjKw80epQ66pPwJT0vrnZt7CCpuWXvjGzG4CUMPvp58i3IxtJUcWkdOe45ubJDtF/0832jkslZOk3H1lKNbDg0BcKN0NI4U1g4cAiZQgjXupym8K586VlOtaLsDo9YfBflE5TpMRGA1SgJZn3GJI+kIywMf83X6BI/uegDTylAuBeG4PhRwl2qA3wReldhXyiIkfYUf/6bwToRYQtp37DXF1vq+iVO+y4fxV/rnUoPO6VyW5DizpqhCdm/r+prJYoMRZjg32qThlwQXxxI+rgW+MYznFHblg= X-MS-TrafficTypeDiagnostic: DB8EUR05HT222: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AuWb4abHtmrxnsotZbdHD8LILO9WGZhCUqqVkb/Qn4OVO6ccJyABNxFSaVFnJUDmsnbqeFk7HgIULzIqvtMicUhvXK9nogRFJydeMjMONRr00pXGoR0Q1gdpMdh4IQnDqqcuKHtabw0HHN3bVddEeHDaQy+SeHLiKbIa3iACQ69nNl6l76Mh9nYX1A7rpHDK5IrWOUJFp0uxRTAVhV19D+I085R3UG6SHI1Q0UNkdpHxLik3ENXrX1rYpXcq3OKLbF10CM9kgbNvHooDzwvVbUb9QRqsbGRoFbqPsnuQAIzG8jNQ+KNdJKfMUdgg8GaI4KzQJePZTa5z1KaT/J6sWw4wPPgFTSbLl3odZrKdPYCRqs69tNujIZpRySE+wYAPhk/kzpRsLvsziPBXcUm0FQ== X-MS-Exchange-AntiSpam-MessageData: +xVkrgpZ0mcfEMJWmj+3jniqzgYxgVc/KAPC++DcwKgmCI10NhBGCvj5k4u0oo3ZWHAm+RGPPkFF+ZEWtGc2WSw81zTPrFqnDQjj2TvhP7adQbZsWtf7rgJPJiwknRyOUYWK+FHaUKY/adFTh1fgYQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9678f18-466b-4c93-815c-08d930560980 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:53.6962 (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: DB8EUR05HT222 Subject: [FFmpeg-devel] [PATCH 32/54] avformat/oggdec: 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: cHS401mI+qU1 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/oggdec.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index e5ca3272cd..bb289e0756 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -732,10 +732,8 @@ static int ogg_read_header(AVFormatContext *s) //linear headers seek from start do { ret = ogg_packet(s, NULL, NULL, NULL, NULL); - if (ret < 0) { - ogg_read_close(s); + if (ret < 0) return ret; - } } while (!ogg->headers); av_log(s, AV_LOG_TRACE, "found headers\n"); @@ -751,10 +749,8 @@ static int ogg_read_header(AVFormatContext *s) "Headers mismatch for stream %d: " "expected %d received %d.\n", i, os->codec->nb_header, os->nb_header); - if (s->error_recognition & AV_EF_EXPLODE) { - ogg_read_close(s); + if (s->error_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; - } } if (os->start_granule != OGG_NOGRANULE_VALUE) os->lastpts = s->streams[i]->start_time = @@ -763,10 +759,8 @@ static int ogg_read_header(AVFormatContext *s) //linear granulepos seek from end ret = ogg_get_length(s); - if (ret < 0) { - ogg_read_close(s); + if (ret < 0) return ret; - } return 0; } @@ -970,6 +964,7 @@ const AVInputFormat ff_ogg_demuxer = { .name = "ogg", .long_name = NULL_IF_CONFIG_SMALL("Ogg"), .priv_data_size = sizeof(struct ogg), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = ogg_probe, .read_header = ogg_read_header, .read_packet = ogg_read_packet, From patchwork Tue Jun 15 23:32:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28337 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4313222iol; Tue, 15 Jun 2021 16:37:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuHPmKqjvTcQPykNelTIhWK8DjXvYRz2jyUjnUxGRfNDXX69Pc4A+5N/QoC/spKQDVLpVD X-Received: by 2002:a17:907:2636:: with SMTP id aq22mr1421529ejc.48.1623800279361; Tue, 15 Jun 2021 16:37:59 -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 ck28si277691edb.315.2021.06.15.16.37.59; Tue, 15 Jun 2021 16:37:59 -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=AjQLFRRY; 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 69961689E05; Wed, 16 Jun 2021 02:33:59 +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-am6eur05olkn2013.outbound.protection.outlook.com [40.92.91.13]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A2D5E680454 for ; Wed, 16 Jun 2021 02:33:56 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EcpOBbgkMEHAus1mCRpHj8RGJaJIx5eWctuxu5xQKS3OvmfX/cwexPxo8/rZlUeRiyBJDjySww9GQBsf/Mq1a8nV0KdU16ysPitRLXAUNud1/cFs0YP/JMOp4o/UPdP/7t/eZBXWL2aj+mxsyNgo5d8nfdzSKV+HzC3GDKL28Eqlg9KzYmCZH6qA9FfmdyTUdGVDlO36eru19ioYM7i418b6kWcMG2lap+rd/+H+1mSf87g2GI0/ZEjH4nmf1Dd/g5qIVAcg5JW/q5kmFGvobpymBkwX9JLmgF/TXeIsIjq7NBckU56MG2ndY15SIMzEAv/ILCNl+AS3OUqEq3HeZw== 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=l88/KW70dmBGLhAPLajIGzkMNtYPhI6yDUI2qhWniNE=; b=nwe7kp663Vuy7SpfOgbsr46d+i9rWmd8GWAk1/DyZuADOLafoewl7oJdA41Bq7+/P6huzDqMES4IGiVAnsB5mSxojJ+tDtOxo7PyeLCqKfm8wTzEAAe6DCIyj9SCcUexXAlpe4UKzwMaGo5kCKwOa9vuDP8vHLgaxgqts2GC7UrtyYAtn67jIfejWnMQBzHLC0iRKUMBj0tGDiS5VPnF4IWwJ7wgIUI3b1zQVwvEpfQP+RXih3N1vM7fdlNmKufP0Tfjm4qvNIGKvUoyM4Z4VKOMg0YmPbYNeL/2ZGnCkjh+c4regyx/sMFo9Gf5i/djPONQcSFd/NT9EdQ+stCdsg== 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=l88/KW70dmBGLhAPLajIGzkMNtYPhI6yDUI2qhWniNE=; b=AjQLFRRY2SsF7OwcgQIaqns9D5Ew20mLXtqksJZzAvbUomzoqrYpdZ/clAnt6FETts3SdbkMbR5M/X0+gzW1FNisVxHU9SaXxkWc+QgCfJ9Xf4DYJV1HKu/He6PHELytCmLVEgdtCa4Jn589aYmH7j/Mq9n4xljodXnhCXkTLeqyuo4Soz4cOWXxAh/niuBgo55oa5LpKk6tN6cGxpmkZYonSJOSynrL79I/1ia6/BTFLuARwHNqX4YncrmARR97WfaCiW55x0/I0PiZjsR505F2o4u3+7yl9AC4Eq5KX5YjFbaWxnuOFoTLxgtY/d/eY07VPV5dqWDi5cLEXX9UHg== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4f) by DB8EUR05HT042.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::331) 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:55 +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:33:54 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:748EDC798CFE220DA88F3D18AC84D379477340B054D16B5FB4D9E39B78A57AC1; UpperCasedChecksum:A640908BE4B9925C125C21F4A7590115B8AF95C93BEBB16610E32E6CFA6A7FA3; SizeAsReceived:7757; 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:33:54 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:22 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [cPsDS+HywZeFZjhI4halT0qaASOyq043] 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-32-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:54 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 2144fb1d-be0e-4887-aea3-08d930560a37 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pWhkGqqrkWQI9iFk+2+eJIDJWKWaMe93iaYAQv9ZGrjk1M4WfsoZBaS7wse3fAN1ZCLoPQwWb0DxVzrWd9bWPYp9yKHg9Zqd+Kpx7D/1h6/UYk+P4RhdpYm9DsQUcQILdXALdRCVBTu5M7lEgYmLEkaVcJAagxx+5NQXrGv10yLKiDNOJbHcBKiVDp+ihrvMrfrSX25Yiiv8A1NgSrILs062VO1SMYS5eGfE9u/yaLsLJ2B9k3ind+Lr/CLtEdnkl/ycChGhx38GeoN+Aa4Y86E24cOeySZc1o5wCePiV1gXyfVDAhCIyPei9yk98rktoqFG4/PpDiQj3jNG7SbbhYPu8f5QrXGtjStWabgrqAgBjCVbxaVcKX3LRGdoiqTVCVQKuRjaT0SvbOHLqfjpfaopFvh//qsXIXW2yfCgSGOrauJDqMLyJUiPOLNTZPvWihkB5Yyd7KK2qAioLRkaq6h+mdzTbPL1D7vzxggXHR6sr9Ywb+v081F53nQKtSMn9sE1RUPiO3Q/SG+lvFBtR5rG/9PxB8Y6PCMYXJnnjtzdJml6ugdujH+ocUdobVDjpPww6Wjo5Zn8liB7rxJ95E6D00pmU70D05Gx0PRk+PNJIXQ3HO46VkBe3hf/ijbN9ZfMtHQYWT9tGYxkd471IBtgonvjFP8rEb5tyRQpsHAt2ZQ9karIvJbjKMljAxJvzxzT8aSMVBc1yGikwMi2ZjjRIZBHbl5175htGMcrM0XA= X-MS-TrafficTypeDiagnostic: DB8EUR05HT042: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PgliU+KfueuYLfWZY+aDCw15hkjdwTu/4n+ivp2dgxcCx0NYH5kX//qaFXOKIA69KD83LyUHykrrh/ZBOfJrlB915c4CcWxyM23DejqhTZQbiSgpEPALQ89sJL2Rqre4Qqpfa0nJbyHGwOw50E0su1ofWgw1SRo3VNBAfp3u5fi9MY+A0AumEOj6EVAcojLmdstP7gLkh91lJPyLhh4ccQx6Tw7uuxhU0MHM7yas+idZUEi/bqPMMJFQ6DMRFM7MzPZyPCOZb74NMu1XhCul6FWvGlX4QUf1vW18S9R93wL0LOHu7k64XxIi9WvY5uq1YmydrZ3TPZodAD4Rz9k1BS/z70avGw5Az9dfcZtqwvw1CnnF/c5494TWBhGUffj+xS5yL4I3lOQCuM8OUw1k4A== X-MS-Exchange-AntiSpam-MessageData: kBLjBf4shXu+6eU1ahBkqOba3NWLk3vShYKifY5e76ifktZolLrvPSGeXTvze/2okTVpRGjp84DbaN5xOvpHz4EPxmJoMK7d9/cQevLOZpGxzYIFaChmYa5mylF9qdaG0cRTGIBLI1iB/sCEK9bMhw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2144fb1d-be0e-4887-aea3-08d930560a37 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:54.8906 (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: DB8EUR05HT042 Subject: [FFmpeg-devel] [PATCH 33/54] avformat/omadec: 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: L7wp6qwzYGxv by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/omadec.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/libavformat/omadec.c b/libavformat/omadec.c index 8891cfc4b6..d2f7408709 100644 --- a/libavformat/omadec.c +++ b/libavformat/omadec.c @@ -449,10 +449,8 @@ static int oma_read_header(AVFormatContext *s) codec_params = AV_RB24(&buf[33]); st = avformat_new_stream(s, NULL); - if (!st) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!st) + return AVERROR(ENOMEM); st->start_time = 0; st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; @@ -467,8 +465,7 @@ static int oma_read_header(AVFormatContext *s) samplerate = ff_oma_srate_tab[(codec_params >> 13) & 7] * 100; if (!samplerate) { av_log(s, AV_LOG_ERROR, "Unsupported sample rate\n"); - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } if (samplerate != 44100) avpriv_request_sample(s, "Sample rate %d", samplerate); @@ -486,7 +483,7 @@ static int oma_read_header(AVFormatContext *s) /* fake the ATRAC3 extradata * (wav format, makes stream copy to wav work) */ if ((ret = ff_alloc_extradata(st->codecpar, 14)) < 0) - goto fail; + return ret; edata = st->codecpar->extradata; AV_WL16(&edata[0], 1); // always 1 @@ -503,8 +500,7 @@ static int oma_read_header(AVFormatContext *s) if (!channel_id) { av_log(s, AV_LOG_ERROR, "Invalid ATRAC-X channel id: %"PRIu32"\n", channel_id); - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } st->codecpar->channel_layout = oma_chid_to_native_layout[channel_id - 1]; st->codecpar->channels = oma_chid_to_num_channels[channel_id - 1]; @@ -512,8 +508,7 @@ static int oma_read_header(AVFormatContext *s) samplerate = ff_oma_srate_tab[(codec_params >> 13) & 7] * 100; if (!samplerate) { av_log(s, AV_LOG_ERROR, "Unsupported sample rate\n"); - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } st->codecpar->sample_rate = samplerate; st->codecpar->bit_rate = samplerate * framesize / (2048 / 8); @@ -553,16 +548,12 @@ static int oma_read_header(AVFormatContext *s) break; default: av_log(s, AV_LOG_ERROR, "Unsupported codec %d!\n", buf[32]); - ret = AVERROR(ENOSYS); - goto fail; + return AVERROR(ENOSYS); } st->codecpar->block_align = framesize; return 0; -fail: - oma_read_close(s); - return ret; } static int oma_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -628,6 +619,7 @@ const AVInputFormat ff_oma_demuxer = { .name = "oma", .long_name = NULL_IF_CONFIG_SMALL("Sony OpenMG audio"), .priv_data_size = sizeof(OMAContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = oma_read_probe, .read_header = oma_read_header, .read_packet = oma_read_packet, From patchwork Tue Jun 15 23:32:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28360 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp125210ybk; Tue, 15 Jun 2021 16:38:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFMsmI/wmoh1m0Vtnh6Ts6lGKWCO4fH9YcwYiI7ju42WNy1UZUxzbQTf25IOenan+hY/gx X-Received: by 2002:aa7:ccc1:: with SMTP id y1mr686638edt.333.1623800289350; Tue, 15 Jun 2021 16:38:09 -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 s13si296179edr.184.2021.06.15.16.38.08; Tue, 15 Jun 2021 16:38:09 -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=JmY7WMR2; 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 4A380689EC9; 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-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2056.outbound.protection.outlook.com [40.92.91.56]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 87398689810 for ; Wed, 16 Jun 2021 02:34:33 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HiOnCpgeaksgVabBe6SZg7sb7d0a7TD+lIvvtxINrVDotOpXBX7usXA2BIXaf7ub5eKekDRCg7hdJ2nfsVh3cCursecp7Th4rd9R/jT4fTM0OCpmzyzkCLgUnWtYJ4+MCHDc8pznonZrKg6fexExqWx/mxbgfxRZEPBsbfyS8gvCe3GT0RrAyOGEJzFtbxr35w4K+UK0Q4ZUyGAICirMvcSV2/PvcrSU1mBVazRpuDztYgf5ve2O/dUKRJ4O7JTPsBA8mNy3OmCUNIViHhpB0gKeI2QT5cYIFB+BqEvl6bySVGWAUB71j+MhcIhmx58ZbFIXUfa3WiV6tjVTGKTh4g== 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=gT2MQJs2IO6XPXmwGpIfeH4dF+ctjbd2bl/NAT5eiVo=; b=E9Tma5uOG6KvCrUGuGrqBNQph8wCPp403NHvPlHe11W6ZstDsJlLzhdYsz0HaFEqJloM82eDbHRof2N69sUFF5aTdipZ79CIsl4MzRpGzyLNAWP6XHbOkL0VC++vujgS7pyPW26Xw9+g/XtZGvRBVTUBht6+zhA8LsBxpo8ET0462EGSsTGOcLX1/AilLKvlU+EwldzAG0x2GNiB+yQgONN1JT8LhB5QgDE0vMlnO+k2rH2vn2kFloSE59owaPcHVcnhnsUs+Ol06N1KiYvW2s5hvGgTOb/t8VfiHjkDBxQL9tZwWNksAGBeZ4x8CFHmFpL6Z5X0CSJWOMUfokpzDA== 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=gT2MQJs2IO6XPXmwGpIfeH4dF+ctjbd2bl/NAT5eiVo=; b=JmY7WMR2bp2327gVxh0ruJqPgI/gmyTu3B7uEum/gHij6gv19XVkQ32PYzTnvhN8Sj2Lbg6+hCW7MebZ6/SF47DOK90FiTK7j2ra6iPgole2h3AheiqtEqK5xFYx/6dswWwwJCJV3L6zp6vz8w7xTNeY/X7kHFkP9MYDzZBjYnt+dhYWySFmXkuhbdEte7MxdsSzIZZdsknagnO7kcfyO9myS4N08oG/1JgYMrF5QXpWBxa5n8j8suGDLE7WgOUS0yDS7hXiAfqV3TBQIbpq4g3dA5ILHhH+zZwEPvlvJIdo4lGuHLuxTZK5X85wM5CDfURFoSsUAtMwju3dmAVmvA== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::42) by DB8EUR05HT009.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::415) 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:32 +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:32 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:2E8E67FA6C4F97F9547C72F8AFF7F80259FBE75687E9E79D0C95226B3E04BC8F; UpperCasedChecksum:54FD47F1542F162519A5EA405593DDD74842CF5C7AFA613AEA85F8F910B77406; SizeAsReceived:7766; 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:32 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:23 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [0qBGtuHfM3IU0goARWA2xUVy0B2INMa1] 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-33-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:02 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 67a15875-b4f7-4d54-6074-08d930560ed0 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjPqZAVaEpqRj4QoGwg4weBa8jIV2yJSnHp2W+3XoAO3KMSsYVinpFdpWxJqvQk2jlRVRwMaTJXHcNbOCqnQwHCQYIR0FfbPOr1MYCg9sBxfkuo4ZPO/bgjFdKfHZTVdrD0HQKtGrCIIVTafoS99qQZKIIQDz++egZQoNDBtul44u1zF2f3coFfAr/Nh2kZ7V+V9mL8z8aiR/gYX0XI8NnxOvTdqGR58uLYq+UJlaKzW3lQTsOdEbPVxXXBnQwRsYom8pd5lhB8Dszbc2fC4tcoTcWeU5SBgVbo2yaZLaFq6fJu1Rs6V1F9h1HcwgGOszuchPFv67XIp+ZXxgDGBD2jnpoN9U9G7iUgn3OvtYSWa4Qp9srzsPvXOLEububsY+Joi5FdXy3noK8eW8dexZSP6uMsqqJC+Ty+rC8LvY1lTBVkJWlWZPk4DH9NbkpTM4nOiYQ4ubFgfu5t3WOuIJPJf+0Fc+TLg7kpR0fsqUJgYMlORXGJ6q5IGonDAhtVxndw6kMmOc2vKDXJeL8CSyA+YIFcUpeaCqCB5tZ6GVUfwRhlF4Y9ONxV4/FLp3kMQ4/qEDaihAESifHHBqOMGfgKnnB/7ilocqLweulwTyWdd4ACBtfULus8uSFpnO1A6ABfBYoqNi9Olie9gK3i3LdxJjvDizh0RHnR5JdSA+o3O7wsaBqEnlvk9lJaCsefG4f4m3WaNpCltich2QuBGnwmw= X-MS-TrafficTypeDiagnostic: DB8EUR05HT009: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fL6UMrQWdFLQt3cGUzQ0SaWw5UQyqgRVVE3OvETwV3ODVrBVpAUfpsq9+x1TjWQF27PmICT83hyyCsbDPKpAnpDdj1F4ngV0pT5hQohTkpTLRLxFqu+VYDLID6pAU4gW+wuXLEc4xc6ph9PAs2+D+goCtxO9BZkPSB2KhUlYmNNoURHYbCMq90t3i73sq9vlj8OYcn1t7ycbCC9su4ppxnAWExXaeiBEYv5pGzd8Rh62OXZgIJj47IT7SYmMA0astBVo+DW8pMcd+o4v8WmOcHdDFJQu89PqYjkhBFH8Oqs0THkQPMK7qCt2Z5pejXuBjGrDAIY8QrRZdfjC5hp4yMK3fQalMnSYl9X3q8GDlsgkSdWp+xOXeeS9Gq9VT11a6BpaLjBXAF4eewQqd8bMdA== X-MS-Exchange-AntiSpam-MessageData: Oz4FcGI4mBrLOYr5lxJ/kBYtj9V9lph3B5VgeTqKNb+IeGaxszHErwz88l1pxyelwQraGMeWX9C5oNWf29f+8PLSUPFJkvpdjk3pm5d0SdUxq5ymsoDXHbM0mGvK69e45bBPby5oYZUKJElTMLZwog== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67a15875-b4f7-4d54-6074-08d930560ed0 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:02.5922 (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: DB8EUR05HT009 Subject: [FFmpeg-devel] [PATCH 34/54] avformat/paf: 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: BODQJHEIpqF8 Content-Length: 2019 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/paf.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/libavformat/paf.c b/libavformat/paf.c index f48b2e60cd..2d2d7f8dd8 100644 --- a/libavformat/paf.c +++ b/libavformat/paf.c @@ -172,22 +172,20 @@ static int read_header(AVFormatContext *s) !p->blocks_offset_table || !p->video_frame || !p->audio_frame || - !p->temp_audio_frame) { - ret = AVERROR(ENOMEM); - goto fail; - } + !p->temp_audio_frame) + return AVERROR(ENOMEM); avio_seek(pb, p->buffer_size, SEEK_SET); ret = read_table(s, p->blocks_count_table, p->nb_frames); if (ret < 0) - goto fail; + return ret; ret = read_table(s, p->frames_offset_table, p->nb_frames); if (ret < 0) - goto fail; + return ret; ret = read_table(s, p->blocks_offset_table, p->frame_blks); if (ret < 0) - goto fail; + return ret; p->got_audio = 0; p->current_frame = 0; @@ -196,11 +194,6 @@ static int read_header(AVFormatContext *s) avio_seek(pb, p->start_offset, SEEK_SET); return 0; - -fail: - read_close(s); - - return ret; } static int read_packet(AVFormatContext *s, AVPacket *pkt) @@ -275,6 +268,7 @@ const AVInputFormat ff_paf_demuxer = { .name = "paf", .long_name = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File"), .priv_data_size = sizeof(PAFDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = read_probe, .read_header = read_header, .read_packet = read_packet, 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, From patchwork Tue Jun 15 23:32:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28405 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp125462ybk; Tue, 15 Jun 2021 16:38:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxg+ZpeFnAzje5XIlZtRA6G1BZ7ORadM3W1Qt3qfbBNaXEkAG5bC9Dp3iZnFrRLEK97fbfJ X-Received: by 2002:a17:906:b2d6:: with SMTP id cf22mr2048110ejb.29.1623800313536; Tue, 15 Jun 2021 16:38:33 -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 j4si452408ejj.545.2021.06.15.16.38.33; Tue, 15 Jun 2021 16:38:33 -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=ZwP9rwPn; 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 BD2FA689F86; Wed, 16 Jun 2021 02:34:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2068.outbound.protection.outlook.com [40.92.90.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1B8C6689EC9 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=KSRMJU9VgK58ArqILWYTjOWYE8imw5XJcG99w+f4a6+92wCYdNDuxPtCpWN3BhP0aaqUHy1xeqlHPWLWpWGD6GcHXCz1vmzow7z9brGW9YDGeEMKlKXvzwPiKJpfL2hXiJUCUf1jzrmpgZV1/bSI5wtu7jTQ+kFAkVZkhIfcSBPijxNkd3+zks+xJMPj3BONhYv3Lit1tf7cAvbQ5eHLIx68OrHXpOAV6mGD4ecKfFLZnPz1HKDHVuT2KYoJfjr85RNDjV2AzmfhJSF2b7g37IHUALzAowhk4TDa7CElKfXvvfwghiosZxH21C0FZYsYNdj+3YQVF42l5myWZxRHrA== 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=RZDSMXJcFIAFTuja8C8Jtu7gqdToUGCm4MC5vpWGUo8=; b=DlWAi3RlF9rr8APvBV/HzzD3QTjXNGcn+vPPZL0AUOcbqM3uefx24MSndKTX9UPwJhwCw2ZOirkDSVlEuKZFNQ/KuKQ9nVNB0pwDXyGrvNx8S4lZv3Prw0ujstrQvL0j6PX2Jsg6YEYwAfUUtY36iD/cmmEURbdnqDqGo4LMqw7SEzTkiA/AT7UdpIEI8QPK/MQrnYsGnEMdiRyAiCWSUssvEBypo1r6a9A5kmtb7Wz4V2Oice3qeXJpRLqbS6d2sg5+gP7glO+PqB8cFEKKTU+IcOCw4NrjSfW3orqpUZ6d7yLRbkSavk5ncUkz4eCGPcMDhjfqVv+LVGFU9CHx/Q== 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=RZDSMXJcFIAFTuja8C8Jtu7gqdToUGCm4MC5vpWGUo8=; b=ZwP9rwPnzrmyTgzJvBQBv6uU6aKQvPszOAyeIOOR/cYmvJDdj7GTSNkzDsoZWVvPzG8902jcgqwybAlUarvc2WsfKvJgfaWhfBq1R7R75IKcTzQk5yjwiP+RrQVAf9jSWe4F28xf3DrVBYOBqSzEKfjQ8Ju6S4UKd3KYmbs1361rsqZefBOAnRDz/HdcAPUUnh4IRTJq8+riLMng+pyPr1kIxnldCiax0iqqzWtL6RQjlwdKqRJnHu6v4OF2/Q/2NXBwU8e0UOzFCaK/bBeID3AlYDpbhIbOhlG/QpUM11HctVA8HNuUd8HnK02WaihjbVfIoajhF5PsDq/MmsWS8A== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::40) by DB8EUR05HT101.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::70) 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:3DC44A8CEB4B029D87840E4BA18D4A552AE0D6265B6A3BB77E15CA2EB0D37E91; UpperCasedChecksum:D04E65688CEC7F6C65D4758BA6CC19C8CE17D0E31085BBE5C9839B59428E2C6C; 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:25 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [g2n13eOiehTsS/Ggx1I9leoOcSknIZ9W] 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-35-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:06 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 24aca0d3-1748-49e8-1f04-08d930561124 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pxqvSbscfQ5pryE8dPqh0BCBhR040DPFGvUlq0QrJnZHhB3J6VjdG/2J+/olHksuufwHaFXbfs8VsBKlOuw5jXqzh6kM21oXw1yYSUgftu/GGnPf2B6rpCItRZX67RIvrMhXuh9FhaArQ15uKTOHOQW/kxsFWMPLGw4GlyEE4+pqTG9YYSwmzZWJoZsIA7L1nXk0cfAQZvkmlzLkmTCRPHr8G+Ko8RkJRSzvfkb4/XJQ5ioz7ygHA1DujjNeXTspq9kDJGA4pjkkJJJ/J1i0hHu8PELS+FgBf6FSLTEzh0b7ScamqtFGtlexhX9HHE9jzgzmfnSL8GoLI2FHlFG+2DN4M1doXhRMnvDzWDBxO0ZkEB1AKtlTtEMLf64SieyeoCLZkQE2Fuy8kjVifCnHXJ0QqsZFyLkQT30jo5rYqDaLJ+BzdS4Zrw3gRLzHXAg+78I56mr4wqxbTObIj6qXcyfuF5DD57dnuNYgTdRt7qPlhXDutHoOnoWugB0iSCSGOkB4GXfqDWez8Q4y9ld658VUqnrpQNi5YGZndC1Tv6LgmRwJ3Ypniz9+NJxLHWaUZ6C8CN5v0YSiLiT8CIgzbfuw1EyWcDP3jkxJXBqeic3uXid7fNn++hYVS9qZ40gKYzx+4FKN8Ke+GO2asqZOEqLbtAnKjIoGYqllhsVmXQ7P/Tkp+OsDp1C7ufrS47hvFr1JEfXcaNQWW6vP4G9emfWBCejLUO0xSe/6XEAEOveA= X-MS-TrafficTypeDiagnostic: DB8EUR05HT101: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0mkVlJ2OXoXplIZObInTbanjoBFtXVDRTwsHDomkSiIOgio7doid7idK8XdzKc0msbojJBzMv7R/RTw0ifBp7xQbG9cL8Wi/G1GlPo6DY9zxetOPAaw7LmfZjtvmVQHe45VArUVo14t6BoVuC1Zcqi6nVuOKjNjlNoao73hLqp0XO21NtTvgyftG0S6qVUVc27cMTC3FnrlfvJRmF8ApwkVMvSVj2yD4FLkXEo9X+z0/SPRmJxHEMtYTVlOx6C/00l7qFiQN0PWh8NUj93SBHnckzUqlipVjIUO+QgqKdRURHMQbqf+K87pLpYT69vcU7gDPJ4hcTIp7ZfIMBWMr+fiUowU/vquIhLhbEUFsMBzANheeVHlgwZ2rfIKg9UU+CMgpHwUZQL4xBABpjd33Ew== X-MS-Exchange-AntiSpam-MessageData: sB3fw2ETEsg4I8fAY164HOfWZyoVEHzg8TsIfdlsQ7J+2zpZu8QNtgAQlSNnYhYUZ62cI3myjcStP7fjbdO6f8S/Y1Aafvp6rrr5mo76/Q2RP/esmpX+gOv/47+VNHKS8nRAjDtWV/5Gg7QRpINdaQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24aca0d3-1748-49e8-1f04-08d930561124 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:06.5085 (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: DB8EUR05HT101 Subject: [FFmpeg-devel] [PATCH 36/54] avformat/pp_bnk: 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: wX27fTSKkv4/ Content-Length: 3314 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/pp_bnk.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/libavformat/pp_bnk.c b/libavformat/pp_bnk.c index 9455a575b7..c500ac7d9e 100644 --- a/libavformat/pp_bnk.c +++ b/libavformat/pp_bnk.c @@ -144,7 +144,7 @@ static int pp_bnk_read_header(AVFormatContext *s) ret = avio_read(s->pb, buf, PP_BNK_TRACK_SIZE); if (ret < 0 && ret != AVERROR_EOF) - goto fail; + return ret; /* Short byte-count or EOF, we have a truncated file. */ if (ret != PP_BNK_TRACK_SIZE) { @@ -157,15 +157,12 @@ static int pp_bnk_read_header(AVFormatContext *s) pp_bnk_parse_track(&e, buf); /* The individual sample rates of all tracks must match that of the file header. */ - if (e.sample_rate != hdr.sample_rate) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (e.sample_rate != hdr.sample_rate) + return AVERROR_INVALIDDATA; if (e.always1_1 != 1 || e.always1_2 != 1) { avpriv_request_sample(s, "Non-one track header values"); - ret = AVERROR_PATCHWELCOME; - goto fail; + return AVERROR_PATCHWELCOME; } trk->data_offset = avio_tell(s->pb); @@ -185,15 +182,13 @@ static int pp_bnk_read_header(AVFormatContext *s) i, ctx->track_count); break; } else if (ret < 0) { - goto fail; + return ret; } } /* File is only a header. */ - if (ctx->track_count == 0) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (ctx->track_count == 0) + return AVERROR_INVALIDDATA; ctx->is_music = (hdr.flags & PP_BNK_FLAG_MUSIC) && (ctx->track_count == 2) && @@ -201,10 +196,8 @@ static int pp_bnk_read_header(AVFormatContext *s) /* Build the streams. */ for (int i = 0; i < (ctx->is_music ? 1 : ctx->track_count); i++) { - if (!(st = avformat_new_stream(s, NULL))) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!(st = avformat_new_stream(s, NULL))) + return AVERROR(ENOMEM); par = st->codecpar; par->codec_type = AVMEDIA_TYPE_AUDIO; @@ -231,10 +224,6 @@ static int pp_bnk_read_header(AVFormatContext *s) } return 0; - -fail: - av_freep(&ctx->tracks); - return ret; } static int pp_bnk_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -336,6 +325,7 @@ const AVInputFormat ff_pp_bnk_demuxer = { .name = "pp_bnk", .long_name = NULL_IF_CONFIG_SMALL("Pro Pinball Series Soundbank"), .priv_data_size = sizeof(PPBnkCtx), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = pp_bnk_probe, .read_header = pp_bnk_read_header, .read_packet = pp_bnk_read_packet, From patchwork Tue Jun 15 23:32:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28324 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4313504iol; Tue, 15 Jun 2021 16:38:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0nxd27YsI6Ooq7g+f8Qo0youiLEtq3oyQY08DCOeIWyMyHrWtVoHTfME3jAG21v7JZA1O X-Received: by 2002:a17:906:dbc2:: with SMTP id yc2mr2116883ejb.390.1623800306456; Tue, 15 Jun 2021 16:38:26 -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 s17si465417ejq.18.2021.06.15.16.38.26; Tue, 15 Jun 2021 16:38:26 -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=hEl5oT22; 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 0A826689F59; Wed, 16 Jun 2021 02:34:38 +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-db8eur05olkn2045.outbound.protection.outlook.com [40.92.89.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D4D98689EAA 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=dgFj7UHzlRwtkGo8naaWgjKBhiE0zHyFYPWmTaroapfjgidLIg3ApT+uUye0bZXQmJohcgH+zV/U0ZZyL/n0JNcRQ34FVWt95idg4GY1bPskSkIFbHKPhDnpGdZ9lm8m+Z+aSFHd7gn8VzIg1yJ9o1NnTwI7APUiyRbccyZJrmKKZNEgv5uIPqvFMKaX9MbYCflKdFVu3atX22CoS7+lGXULGY9NYgCHW4LGXoRQszNrOIhPLRxbUK6i6R6i60Ej1PNNkWHt0SlcDlOx+62pBEXt65xwSlcoLtEw6lMZQNL6ritYa7dnUqYeylzOKAL6fmboDG76i4/WqMOE9UDERA== 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=1aiLYkDz8H9I004ILYpLvI2SklUHFCJYxaMxGqGnrn8=; b=jjdAYN3Ic9oHq22YENVUaWIttAs0EfO6thG/y1zg7HYskvAX6K2Vv4+11LikfLa9qXNmpI82Wkv74HJLtZwjpsBZSWAJrwc7ce+mtKOrs6492VV6fiWJ5kZN6dvorbv2LeYx4T+yckodm7q2S9BeTM9xVrsAPHIy8pFboaHn+r9Fi5G13SNlm02jKbB1neLsv1W25Gl6W7+4mENaESXeOWrp68EacFKgXITYyzlzkfSQslAWJIuPN7hDc+fWnFB8EGYUUqwGzAg2QaEq2qdjBzl4MaFY640hfOXvjo77SN08ov/GSJQk7Qk/p0tUadmpxORyZdC/AalR3OpK55GSHw== 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=1aiLYkDz8H9I004ILYpLvI2SklUHFCJYxaMxGqGnrn8=; b=hEl5oT225aDoMTKi2CmzRQ/A1QcAR+8RSKnBEVdAO4e35acIU/DXCve6YrTzNu08NAhtBu4yLfxPF2Xjx1Z1UVKBIPvrISKFQ8hAOo3VOqH4DYiPxjv8rSYsoKtfdi5Ed/sIRmemUMnr/3h2dPW62AKA1ZQUK7GDMu4PIN2bG3/tpXlhaFifxcjRAWmFJCrYr3www5Z7qIOUpl0z93biM7rDBeEqnxqc5oNdqvJ5IZmX9LwYeJJ4hFZzffgPJv3pI2zz7Zhq5si40xdXIuJJOPZeVnxJklDtDbk/47yNne1dXWlaVWz6wmwZLTVIoLEgquUgDYrc7cA03qy8AORTgA== 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:34 +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:34 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:63823E2756EC5FE99594D65AF2876C62D032D93992F244DB87460C6050203E14; UpperCasedChecksum:42CDB06995E065589D908C92493A3057291B6F97447C29131805E0A2F00807D3; SizeAsReceived:7774; 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:34 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:26 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [kom9YP6N5xPti0sK2DxWZPkYJeEeGqC6] 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-36-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:07 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 34eb3540-e961-4b1b-9141-08d9305611e8 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n7ChXvHkTLkiwR+s4Q/r6wddMYzSNusoX6p6X49ND2VBPTAu7LlvL7yO3qwByide6JNHsGLeY289vG91GdtnCz+wLFrfhiOwcLUWzBv+/vjjPmsttG54eQwc6YFpB0TL3xZJvGsIXejXx0CZQgAVVvO/7U3zET/GWx7EKE1hCzdJTmQusqfePe4OG7ChuQUtLygTwzZ40xv3LQ+6Gjd9qhT8VJ29rSQSGory4qdw7NvQPWO/CQwLS/TZ0YDVPO6ODCB6CidDqis84crxhRF5esgcVS7IogOErjSENYM+fWM9twd3WX4oFeeodI9xBMynzssxIPgQPtb7WfS/IHbVGzxXVO+TbFLfFjv3D3bx9qPqqJOEplqGf7rOjBJ8LOI0/7Cp+H0nUqe6+t7rJUY0Xnzro+oPy45qQCuM2O0PKmjorkB+PFaVUNou0SYlZQw2sxNe81eVqpy5auyAINZlD3jmMPknUV1IoFgElK9i1JUCbYFSm2yrEKsDOo0GePI2QQbZc6GPqPohJEy4xVBgZ/pcKJRt51R5HFKgSpeLRz34Oi/wgXAjGmFvzi8OHZSbM5mQ9Oj510LuEIb8w39H9D98ud4ncGX5TG7fo3Sz6JhTOa05ehaflnMhk+L7ILrY5lSJpCCNUk5HgQmT+GwkS9TQN1F2iChkVZJXsirjMU3HCOaP4hRJcq+W6wbOk34//mPhbQ5+BpT1QbnaKyHaiXeN3M5QvMQgik= X-MS-TrafficTypeDiagnostic: DB8EUR05HT247: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qGdbc+wib07+RgXBteFpZY3dGfvxH3HrZuaMGAueONqiVPS5HAtjqdRd791pZ/CVOzjwBEm3so63RkgcMyChmfkauPXgw4sQMdNRqa9sq+JYVJGfj6iOGCSTeA2O0g2rUe1Wa5aTKh2liCF8JFDrx2gpmpDJ73SR/dzm9brmvfFXH4H0XPUJUMQielDPVhf72rYoZrXTXoqUEHy0zWhfXh4CGHofpMhRpx43kNAb54pZWvC0Bh4wQil9CHPJ56VhSuglh66KTzbLI/IbMFfRtJq5PB1abC9U9t3FOlnGlrQKdr1nTy48B6gIs8udK0fhCWB9x6GoJp4HcgrMPC13w2RAZLlgmbly+vghZ9qzs//Ac0vKQQigsDO+sZQypmjE2eZuAU5qt97Uqcj31+wyyQ== X-MS-Exchange-AntiSpam-MessageData: dTD506UUVh7tXxXZ5rZxHzewUUakgmBJ6te7ohPG3S+kGEwCy3vQu1fxO4ZQ6FWKOZM/qcxhxDChYWfrKnZDt4+myx+G5Th8Ho8gSwWyUTzxfwJ4nGXnWh9+Ou4YDwl1li/NeDn0fhBH8CxifVab1A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34eb3540-e961-4b1b-9141-08d9305611e8 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:07.8019 (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 37/54] avformat/realtextdec: 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: vjS+DGjgJYjf by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/realtextdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/realtextdec.c b/libavformat/realtextdec.c index 22fc58bc99..f3876d4068 100644 --- a/libavformat/realtextdec.c +++ b/libavformat/realtextdec.c @@ -123,8 +123,6 @@ static int realtext_read_header(AVFormatContext *s) end: av_bprint_finalize(&buf, NULL); - if (res < 0) - ff_subtitles_queue_clean(&rt->q); return res; } @@ -153,6 +151,7 @@ const AVInputFormat ff_realtext_demuxer = { .name = "realtext", .long_name = NULL_IF_CONFIG_SMALL("RealText subtitle format"), .priv_data_size = sizeof(RealTextContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = realtext_probe, .read_header = realtext_read_header, .read_packet = realtext_read_packet, From patchwork Tue Jun 15 23:32:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28336 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4313692iol; Tue, 15 Jun 2021 16:38:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSvHbyLhkj1amwpTCrmjbCC3MZEbU5kbRLT5w+cZ3EovtsPqIh5iqEJfcogT9UTfNifT8z X-Received: by 2002:aa7:c84a:: with SMTP id g10mr703935edt.326.1623800326875; Tue, 15 Jun 2021 16:38:46 -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 v16si420197ejg.147.2021.06.15.16.38.46; Tue, 15 Jun 2021 16:38:46 -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=JiM43VSZ; 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 1774B689FD1; Wed, 16 Jun 2021 02:34:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2097.outbound.protection.outlook.com [40.92.90.97]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7DE6F689EE7 for ; Wed, 16 Jun 2021 02:34:35 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cTIGrqeMPI0x7a1bNDA7wz3FRkY689JzkX8/36WY7Q1Fkvy2moHzC/Qkj1jh59iwxUgXeIPEWbjaJURTTdESaw4zBzERz9cXHrormWrvpogQ0VNOfs8vGtbSMr1C57fyidwGLvNBwJLAQXtmLOBbW3CFyAjAOx1GLfAOvwDuOkQwRjehl0l0ZNggTCyAmjJ1NPNacKtxjnB9iX0IFP674x0WyR1ffaVdqbTdg9zLA3GnjPRDN2stQsx+alS86Ivactqy/VWoxVZVch8uUIKys7nsdUwr9pbNuyyD9f6YVpzJ9qeOtf9XokiQ8FH50+MxdMOv7HxRgoZVwfRyQFPFYA== 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=Isx2+bIHH1Miw2llxnsQcp3ICbczfRX7Qqz1dsxgIfc=; b=SN0rBfghduXy+Xlg0qCGUPMTdVYYj/aXUo5lbMwAMgRV80Uk7wYWdA+EWs0FXcKt87Yyz8G8Q/DlqyPdp+27cos8VUHJnBV7yS0aFJ74vmlMyqg+JeW0+BPOaXTFipq8XDnSBLXK4KhMVXOr+da8goqrHD2hDIs0HXwW7yopNVkLGs0aaDah9xOtCqrNaNgFWUbQgZXFedqZxtldQm1rounmzO8MacCqwZ4zW236J7njYwzM5YyAfNOQGWxLvZtZpBW+Xiu5T0kXb6MQEHNtT3HpjC1po4yJE2uDEWWM0kaYCbmWLn0ArW9NHQnCKDpsn2rI1hHXJff4L9t0dIM9Ag== 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=Isx2+bIHH1Miw2llxnsQcp3ICbczfRX7Qqz1dsxgIfc=; b=JiM43VSZt1wrmEvNv/2SWJULILD0l1CooR6IRZG1aZHaBU+vPkdWS9L8J2L6GlqZgc8kSgXQzva7LYsFZioXHxHnD3neumUsO2TPs0MIq9zoEkhrtEFoFfruzUkTAYLpuw69aNo+qSf6+80nJYQLhpw5ISjwq6wByMCZOoeHcm8rVTme0J5qtkY56kB9tgrRZVP1Ev2wkeC485xTC1MN+mqMkEqW8PruiQlkOOiXoUCobgc9TRcyc4f+sX9sANTf21pqhzxMbc8NujzbjSKwKUrZiUjSq0CSlitXFVohQKTIoDM/WaKpePIDmRE+NI8OEwjSoCRiukR1iJ5nmNcTqA== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::46) by DB8EUR05HT010.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::419) 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:34 +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:34 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:8B9D8FF20FAD5F2E70BC57F29A26B0A3F7BC38CFE92130C6242B107A746EC6B2; UpperCasedChecksum:26D2094D19634D829B3649D1F62B5218A7DA27077A3D7D90972DF227C06C2964; SizeAsReceived:7768; 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:34 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:27 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [9FqO+2/fvRExW0UbOMoj3mwXwMNp+ZlR] 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-37-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:08 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 3acfdacf-5ecc-4d54-9534-08d9305612de X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pWhkGqqrkWQJ/G2nBDhW1VuCUfUvgQwiH7rget1HUOjFrEum45Hm8dZ0aFhI7p6piV1lpH/NDEByCVjmIRJHC/eUD+SmuXBGNOdr//YOdUOzK5I6nkC3GyLC8DBWt5NxE9c1LSHvHirWFL0jcovCXp6X6+976NxreqNMZGGZt0ZWCXa+JZtnW56iggcBWuiGqJI0ZIOfEGeP0+A7YVdf+3AB74lgoZHQByGgJ4wolpeTmSslr6UchuxoNqCqzUIGLhC8CGloaqY7cc4vhNlZTkvJjhhM3lbg2vEYknlf53D+HfV2bOfGVJ5A5g/VopfX1xTgBXjtJDSQIZZRLpO8xHOb9EdCTc+ZlQ5hGgknYjzsW688YEaFbaVIUqfTmORr0vggL0lT7E0Lp1F3rULfmpZl8UQNRpfKd+Od70o9SeQrniTSahh7U6wkRXaFtfj1AguZC3Sdg0+prZd7oVtIStMwUnbDcJL//3OtzCdZr1NRcrop80vB09HMk3D3ORbTvCAKJUOIhXTm51ZYKPUQanD30czP6+TQfJvKMVADObt+TiXpSvpTAk/SCizHfihCBQXR2caCTXVm/oP+6BXgyjvNzpVUYkIJMRkppkg5peQ/VwRZtT18t3lpxWlducvUtGMzXDjuhmHbaq8AEN7/fL6E6nKUIvgQnWK6IwRw2KrM/AcmNFl6ZUwPM7uGhHpWUeUFVfOu8+eKRxuNK6w+uAAAa7Btsy5XTYesAMM6Ska8= X-MS-TrafficTypeDiagnostic: DB8EUR05HT010: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pUpq4AkwEpHUKiHSZhTKDgeY0vPZ58EEA+P07uBwM8BCclFlvYDp7qLrNkG8mmxot6GZt7J63B9h/m2VBx1ZBu2qZEoWJnhYhxRUufqxh/VpjF5OEu3/uJHfS4eEOsomkBZ4wIoWthHk2NbTiXAKYNlHtBhZyAFuFi3xpXzGklfFVmv7fKz1/Ge+2OrrrS6rwq+eum+8GrhHdZzRlo21DcwHi9YH4WW9Q9sNFm5cMsCq+x5rPJuQlxpa2DA0zuWtYQwc/AABJeqrk2A/bUoES/bPfq3F2zHB+sqrWuhNJGUt/LOwv0huI9YzWVzrJI72g3nN7L4jgZPh0YhhY7N0p4ge0n/e9jP+KR3UplhCxRmoEpeSYDq9pJKoXsr39Xov X-MS-Exchange-AntiSpam-MessageData: ybCmMCziA4R0nvS6Fc8CGOl4lapxhTE6jRcUryKSnCd1A3qqSOAxNrhP11snCJqfans90al9mGnHmp2qBTkVIeCfd1F5KLvTqChY2cmw69dInWtzFr1LVU8ze192kKgpwRLZ8Do48T2eVcKIUmh7yQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3acfdacf-5ecc-4d54-9534-08d9305612de X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:09.3972 (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: DB8EUR05HT010 Subject: [FFmpeg-devel] [PATCH 38/54] avformat/rmdec: 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: Q9upSrphuWoS by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/rmdec.c | 56 ++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 36 deletions(-) diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 68b5c3b75a..771c1778fa 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -66,8 +66,6 @@ typedef struct RMDemuxContext { int data_end; } RMDemuxContext; -static int rm_read_close(AVFormatContext *s); - static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len) { int read = avio_get_str(pb, len, buf, buf_size); @@ -563,16 +561,15 @@ static int rm_read_header(AVFormatContext *s) avio_skip(pb, tag_size - 8); for(;;) { - ret = AVERROR_INVALIDDATA; if (avio_feof(pb)) - goto fail; + return AVERROR_INVALIDDATA; tag = avio_rl32(pb); tag_size = avio_rb32(pb); avio_rb16(pb); av_log(s, AV_LOG_TRACE, "tag=%s size=%d\n", av_fourcc2str(tag), tag_size); if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A')) - goto fail; + return AVERROR_INVALIDDATA; switch(tag) { case MKTAG('P', 'R', 'O', 'P'): /* file header */ @@ -594,10 +591,8 @@ static int rm_read_header(AVFormatContext *s) break; case MKTAG('M', 'D', 'P', 'R'): st = avformat_new_stream(s, NULL); - if (!st) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!st) + return AVERROR(ENOMEM); st->id = avio_rb16(pb); avio_rb32(pb); /* max bit rate */ st->codecpar->bit_rate = avio_rb32(pb); /* bit rate */ @@ -614,10 +609,8 @@ static int rm_read_header(AVFormatContext *s) get_str8(pb, mime, sizeof(mime)); /* mimetype */ st->codecpar->codec_type = AVMEDIA_TYPE_DATA; st->priv_data = ff_rm_alloc_rmstream(); - if (!st->priv_data) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!st->priv_data) + return AVERROR(ENOMEM); size = avio_rb32(pb); codec_pos = avio_tell(pb); @@ -627,14 +620,14 @@ static int rm_read_header(AVFormatContext *s) if (v == MKBETAG('M', 'L', 'T', 'I')) { ret = rm_read_multi(s, s->pb, st, mime); if (ret < 0) - goto fail; + return ret; avio_seek(pb, codec_pos + size, SEEK_SET); } else { avio_skip(pb, -4); ret = ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data, size, mime); if (ret < 0) - goto fail; + return ret; } break; @@ -662,10 +655,6 @@ static int rm_read_header(AVFormatContext *s) } return 0; - -fail: - rm_read_close(s); - return ret; } static int get_num(AVIOContext *pb, int *len) @@ -1151,6 +1140,7 @@ const AVInputFormat ff_rm_demuxer = { .name = "rm", .long_name = NULL_IF_CONFIG_SMALL("RealMedia"), .priv_data_size = sizeof(RMDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = rm_probe, .read_header = rm_read_header, .read_packet = rm_read_packet, @@ -1252,18 +1242,16 @@ static int ivr_read_header(AVFormatContext *s) for (n = 0; n < nb_streams; n++) { if (!(st = avformat_new_stream(s, NULL)) || - !(st->priv_data = ff_rm_alloc_rmstream())) { - ret = AVERROR(ENOMEM); - goto fail; - } + !(st->priv_data = ff_rm_alloc_rmstream())) + return AVERROR(ENOMEM); if (avio_r8(pb) != 1) - goto invalid_data; + return AVERROR_INVALIDDATA; count = avio_rb32(pb); for (i = 0; i < count; i++) { if (avio_feof(pb)) - goto invalid_data; + return AVERROR_INVALIDDATA; type = avio_r8(pb); tlen = avio_rb32(pb); @@ -1275,25 +1263,25 @@ static int ivr_read_header(AVFormatContext *s) } else if (type == 4 && !strncmp(key, "OpaqueData", tlen)) { ret = ffio_ensure_seekback(pb, 4); if (ret < 0) - goto fail; + return ret; if (avio_rb32(pb) == MKBETAG('M', 'L', 'T', 'I')) { ret = rm_read_multi(s, pb, st, NULL); } else { if (avio_feof(pb)) - goto invalid_data; + return AVERROR_INVALIDDATA; avio_seek(pb, -4, SEEK_CUR); ret = ff_rm_read_mdpr_codecdata(s, pb, st, st->priv_data, len, NULL); } if (ret < 0) - goto fail; + return ret; } else if (type == 4) { int j; av_log(s, AV_LOG_DEBUG, "%s = '0x", key); for (j = 0; j < len; j++) { if (avio_feof(pb)) - goto invalid_data; + return AVERROR_INVALIDDATA; av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb)); } av_log(s, AV_LOG_DEBUG, "'\n"); @@ -1310,19 +1298,14 @@ static int ivr_read_header(AVFormatContext *s) } if (avio_r8(pb) != 6) - goto invalid_data; + return AVERROR_INVALIDDATA; avio_skip(pb, 12); avio_seek(pb, avio_rb64(pb) + pos, SEEK_SET); if (avio_r8(pb) != 8) - goto invalid_data; + return AVERROR_INVALIDDATA; avio_skip(pb, 8); return 0; -invalid_data: - ret = AVERROR_INVALIDDATA; -fail: - rm_read_close(s); - return ret; } static int ivr_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -1410,6 +1393,7 @@ const AVInputFormat ff_ivr_demuxer = { .name = "ivr", .long_name = NULL_IF_CONFIG_SMALL("IVR (Internet Video Recording)"), .priv_data_size = sizeof(RMDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = ivr_probe, .read_header = ivr_read_header, .read_packet = ivr_read_packet, From patchwork Tue Jun 15 23:32:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28348 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4313787iol; Tue, 15 Jun 2021 16:38:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4DkFC+IloFbN8znCNz6IT18YBt0qH3wyIARBOmwaTxkBl7L3h8SXCwPYwRFrTzpjQWG9H X-Received: by 2002:a17:906:fcaa:: with SMTP id qw10mr2027260ejb.233.1623800336474; Tue, 15 Jun 2021 16:38:56 -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 kl18si510467ejc.160.2021.06.15.16.38.56; Tue, 15 Jun 2021 16:38:56 -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=aJfrn3Y+; 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 12B4868A062; Wed, 16 Jun 2021 02:34:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2097.outbound.protection.outlook.com [40.92.90.97]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9D201689F00 for ; Wed, 16 Jun 2021 02:34:35 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PGQUprXvRLyAGCYwECVG5zE8kUD2z1aKfgDC9DKLHfXxPHDVfa8cXj031CS0YvpORdSXepSUtwbKOL958T+sbb2S2X3kJtmik1f/RTbhLhZdcmmMk34jKzfwfOPU6uSRAS/+52rl+bOccgfvDanP9ri8LdkAdbVHMPMIauIa8TlKGsnm4gkYu80KLwDUiNTSrlANGrqf4r9+YlOkfuvYXVwfplhkaaTw+wbjhYghtoJEzBOfu9siHE+YEadQerOs2781tRzg4Rvdk6JYQjyuVWP+XnuadfbHEk2MkQgLkw0tRbSFI1O5neEwsbtwhSYL/0M5h8NgPF8c8yLEtJI9FQ== 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=vGawsJK3JfC9wI2NxMvS1ERdU9cg2yGQqvnyGxr1diQ=; b=UpCQmrxuIszVkSCONbMqvweRgA9vvu0k56jmPWxX1ciVgP1wSoLE0u7S+u9ZETDYTmCdO5X4xRq9gQ7h70IEek7MWv0YPwps9+P3+LjMNSgKtyUjAqts+3zIGFds/mO/ACAPYjh7Mg83s+ABCnkGq5Y7e2B3GvbqKh7XSazwQrMCgRnKlLeI8nyv8z36pTHZAtK3QT53YuxTuK9M6qo7hWF5IZKM0H49G5DVJWZdYS6IHuJvaaFc/yj0MAhOOkzK0eJfYXSX9IyNEhwGJXb0d7CU67ByXYni0v6DxNIrApelgyFLN/w/bYTr6tscBTWpyyI3oDzFwkB00nRYqY2yew== 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=vGawsJK3JfC9wI2NxMvS1ERdU9cg2yGQqvnyGxr1diQ=; b=aJfrn3Y+vqVsEV0ZNXrmCmRmVJX5IvJLdfm735ZAETm1yXSw61WfjIOs3LT6Huapbp9l51YdH3d3Zv1pNSeWv5kjuZhzhJURDJ0OS56d8AO4+IXgk1jT4R2otmnWDP0klLMd/jcuKKRL8A3dg/0sSEZjniXmsgV/JYuwvCqU1x/ESpeNmy1q3ooX4R4Pm+qvPgmFUD6OdJDvb3dD/UgNt5xim7BnZRhUSPqBeYq+Gd2nzkFN+c1DOxwAzDXvfdhn+sBdb7ypd0TAorARn1r6jliIM+qCpOOTj7ecXu64xOl1YKV88z/5vsLhfFC/ItezQK4S89SOb/sGlk9/Vo/Gfw== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::46) by DB8EUR05HT010.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::419) 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:34 +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:34 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:05A867DFDAD8869ADA1258B48354631F4F1903310E47F97071EB63CA029C7D3F; UpperCasedChecksum:6A0F4245FF561A18F9B54FE6E5EEBC8CA4D7C8DF11535E11F64315E7F34E15D6; SizeAsReceived:7770; 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:34 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:28 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [DzAnsfW7kaX3hHxtT0NVtLeZVNxaoYFu] 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-38-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:10 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 80901e4e-3b21-4ba3-cf60-08d930561398 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n54hrFV+Pl7TQFddBShjFbyiRmNX1GQTvLRu8EE1jVJYzjMkHm/NT0QYplQCmhwZuFc1sAqLB6dKBv8HsNDNCxcmFyg1rmbw3DRo+deVIKIKG3nZlC5pHTWaTIMlk4ANqQ7oPwM2AdQIxrhrsT5Artx0MjpoTqeFXwqfM0cJbC0cUeMlQ4KZe31kJUWwUzp4ydeK+qKgb7NUMq/mdL1KVeW6FD9ekD/U0h5i3cMlrS3fNfg/rBdNidbXMqUQOpd4pOpLkdmad+usyctFjA/escScwQ/IVkvsQLESnmn7/2rkxGX1s3+d98UsM8FS9VskPdnwuZurp0AFsDom+baRvcuncaoA6S/v9M8VgxNSp8C/HSn/wlJzh7zilMkH8CzASjbsc6QAw15CRszYo9EK8qIju9Jbds7JnrYsoeR78ahoamI6GjNlpRbqSEJvRsg/Cnyc7PBZtt7yHA40jKgTl+5IFcV8XNNnYcbbfMqRVGM6DlFNgVjHGp/YHDNI7FY+uKsnLtL7zFlnpsggIKAPrDzCyBjSfr3ykSui0qD8c4pWyLqIM4fC1q9OelbAkeIEKb9g/QebsMKNURj9APRSnsY8EOxkWy5qQagv8MmYDMWb6J1XH6UXxTraXvQlZEmqLjq0ypUSus2rMf+r/Z7VX2QgDQQOyfBoNEcuo2ErWLz/jqqLe9y39myV2EZqdXSo/VlDXWH/fljedZqmCj6TfwCUzLI34m3/BY= X-MS-TrafficTypeDiagnostic: DB8EUR05HT010: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uEMy0NLGdO4oMAO/EwQLqgmeaXTM7QjidAPlkEiEiEsdpNSkTFRELy95sGPZybpBlB/IeNcBeAvZbWEco7LiBRO+M8GHo4FgLrAK7qN4DOHXYtYlxHO/hEi/CFJ7IhcT+DKRLubmWmCrgXmVQo87i/kZ319+i3+7JhCeEVF4qoKJv+XlgEOxtarw96o78I7J/nDxZ+cFluSxgzDDWAd17Q3pcMOdbT/fsII4CVOm87+fQmsOpe82t4fC1BdaB3J1gQZN1m9BDpzc1Df2zCoNza7vXgDhAycL8G6p9pF+OCwqdNOb/EUA3H7y8UGz9T1wJDa7y8BABajg0Lb/5vaRqurqoUJw7zir7oTox6CK0IyOZh5QqInevoBkBuLfPrua6hFf21pXSiMU4OMUW4svWg== X-MS-Exchange-AntiSpam-MessageData: omwABu6N9k/7Z+ea0p9YO9kUY0HFTjgipeAd7izSeY8ELB4ayFo7G+ZyBas06y5TqmgGd0UjB0NF1fwf4/vRzmPqmhrBdN2GVEie4mGMtEQP7YUbmHGBOwmUV5CTesJlYkwG0LpbZTQmB+Nlus3ZPA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80901e4e-3b21-4ba3-cf60-08d930561398 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:10.6566 (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: DB8EUR05HT010 Subject: [FFmpeg-devel] [PATCH 39/54] avformat/samidec: 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: sCb2001fyPaj by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/samidec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/samidec.c b/libavformat/samidec.c index 8f97cb7331..c23335cf4d 100644 --- a/libavformat/samidec.c +++ b/libavformat/samidec.c @@ -115,8 +115,6 @@ static int sami_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &sami->q); end: - if (res < 0) - ff_subtitles_queue_clean(&sami->q); av_bprint_finalize(&buf, NULL); return res; } @@ -146,6 +144,7 @@ const AVInputFormat ff_sami_demuxer = { .name = "sami", .long_name = NULL_IF_CONFIG_SMALL("SAMI subtitle format"), .priv_data_size = sizeof(SAMIContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = sami_probe, .read_header = sami_read_header, .read_packet = sami_read_packet, 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, From patchwork Tue Jun 15 23:32:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28400 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp125912ybk; Tue, 15 Jun 2021 16:39:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyk8vPB0FSOxexutviKW3W4zb8x4my+KWpVoNRle9gZOm2fWb6PBF9nRD7VczZqF7u1nUmv X-Received: by 2002:a17:906:2f91:: with SMTP id w17mr2074452eji.443.1623800350542; Tue, 15 Jun 2021 16:39:10 -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 ar15si390295ejc.146.2021.06.15.16.39.09; Tue, 15 Jun 2021 16:39:10 -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="sUsiQ/I2"; 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 AA46068A073; 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-am6eur05olkn2083.outbound.protection.outlook.com [40.92.91.83]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CDFBA689CE2 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=ORRB8lkxqVqi8vfSYsa9zNi09E86uN4EpPnE32gsOsciOFC3sGiJdc75WgB9bfCmQcYj9TUXQGEWZc0sc0ccnKu3wJPnsmsj/stsYwJ0foBGRn8EtgMApHkYSS0B1lX2fzx9e6aZ3h8Z/G7AxNTPm8HC/Hfx7YVDY04Vj5kC+lPR/uoYIGk7mmHu0tj/130gf6c699n7fa9V03+GUYMWF3vMl69cZmLL+J7sUpyZ2L6cmrnHcA/JQ0Jv/Kp9chTlNdqjlrwC1xb9dglv8Fj+fXe1Qtvzq2RzwNOclOA4tfBHWjFF7maOXj5xY2yCxRsxJHu0SJcZL1NgNvwanzARNw== 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=dQ8ls3pG1jEsojnp9alkYuodrstSHhJXulGUAoAAw1s=; b=QsriFUhRnNe3Uk77jAmiwf4rxYhI3mU8LIc2uLemjVeERo8mRK1Dewares0oh5GBXmZXddy6rmT0jH3twVDvdNcVBuXJBbKlv0fCzOvQL4ECfpgQKVrAu1G+mMhHRq4Gl2LRV4EkpGuwSmd72ThaEFeViNYaxIQmInRg8bWEpX+mLbG0GtiTBk+VVa/5Qbun9CalYiPdTEMO7Rowq7YngGcq6WtmYiYVE94ieuC5xLZWsBv1nzTrs9ZZBvsuT37NCRj3znqziUuonCdeAZmsuYXKUgFPEOQB+v0+Iecx+Tel8S4MedpXHtM1Q7vGQzf2O1rYu14EQ+R4OcGYI3p2Aw== 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=dQ8ls3pG1jEsojnp9alkYuodrstSHhJXulGUAoAAw1s=; b=sUsiQ/I2C693OhmpI+WBeKBm0ALXuvGGmLMs2yX9puoQgU/eJhcTvUrVURGF/iGOu/PxH113QbCrt11ivquWVgE5ifGCH+xgTEf8kRDYCkxfGmWdelN2FOgpMSseXJFsWG/ODfI5L4HUh0DkTuE48I/9q/pmUygLyvL2s6GmHshQ0kuQXx9qZQ3PZXN7VXHrndIPtgSbVKOqNw7LvAhkonNzruU9zSMca2FUVolMT0VbzaKMTFY/uUmNUOHlevkO57CNpMHaMA6vtfa3j2usWrBkdVQLDPP0F1GkFgRq27vv+xUHwy1OXJ3INQybKnmv2M0rmYZpxqra9CMaAKkwLg== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::47) by DB8EUR05HT026.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::75) 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:307DF4653028FC151E4290B806FFD233459A8D72CE0A89E587B2A730B0CF8788; UpperCasedChecksum:B232F32BED576FBA4A3EBD30F7220FF0D39E76A927E58B182D98855AD8F1B2CC; 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:35 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:30 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [XJRQhrP5R0IZH0c02+BsuSAc63mbwTw5] 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-40-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:12 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: a54fd92b-bc41-4c5e-46e2-08d93056152f X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4p0OETr0+Jrn3q7VUpeBo+bwQx24SGCRTbjJtpS8fRh5jRoANiDogjc273fUftsk2QdtBRnHNVyeF9/TvO6gICbtKlZqiXfQvBqrw2SKVbsuldC7qzzByoXOLCMJ7OrE4aiCcJs9D1DOs+jMdtzWgtnVKW0qnLrgixggbRe5SjI1zo6guLOkkUNXrYdNMbb9r+d2y/H3+7a2a9BvwuSE8GCr+VdXUW8cpxN9H1KOWrT3bX+5ie1YsTEa5fNH7aI9gkvaK5DewKTutvVX1+lg/AbnZUYx+E7cbrX9/iG9y7HVAmOnbck9/0jf5FXfFNOu6vh6Lp2fpf+oXxHEvzaNoQ6sChvlyDGTC7ti2tbd1yLwa3cALQPN/t1Zl7WEInb/WUxl9SNFygqBCNnvPHsttGtIQKEtK+FCHLk9EFrPn0Pwu1K4IceX1U/yrNO85yhOUWa64aD75iLA2mMF2X33IeGMJRODTWwEQwaGjq/BDxnDe9AjtLogqcAEFp0NbyvigdYbXnx1fFj9MkAcRIARsAVROkPjEr9f+8RbwHhyFtA7hY89P1KzQKgtTZVJc6GKo9OdTb67NzpI8PU5kt9s7z8si8+u1XMqb4EMF+faoB2VwdyC6CDtoyx2A/xE67CR/JSoMJc3quF/6P/Mobp7lLYGCcHXdEV4+51ce8uh/RXzrBmoIn4gXHrSEUfaHF7NOrgdMKveTNem6WO4W6lALcXsA4Ty9uk2zLKHq+XBPgySU= X-MS-TrafficTypeDiagnostic: DB8EUR05HT026: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Gr9bZQpXydqfFlKx8JS1xHdswS4fD974HEo1aghgb54vxiClMkUj0du19fgwgsCzd0sMQKojPeMrVU3HPDbmqDXw4+AGrJtEf+mW9vSctNI6cic8XX3Q4F+hmH6kRJykZjsLMo1K3KTwHBGVZSL/r1lKImZAH/QqbEyDIyjNUxv5oWgngi7ybvQa/7qyryP/IQ66QnBqpJuV6xGEvGqpaVavkLTRMmreki4e5ye24dJPIfraOv2gw7OD5xNdpvcCADAPtm5jqP8ZH6cK9Vio42pJc9zmFm58AVg1fARdrr1iIkXP62w8DP64EwOhK3fc+aPzFH43nIqH7hAFF4G14I5alay7545b12ffKn2Tsadqhe5Cp3BwP/S8FF0c2EPw5NpxVwzm5lPtgxjUvF7x8w== X-MS-Exchange-AntiSpam-MessageData: xhTly4Iw3lSG5T3FeqvPRf2k6flaMrebHHlGdrlnsyy9LZOBDHwE2dOQShCBZ8eivNQUdRlUx6cWdN6gQqV9wea5NIAoCa8sTcgo+xm1z/QJT1ibaQyRVqiMLuhKxWLnSlH7i5i4Bex7TY63nvM0XA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a54fd92b-bc41-4c5e-46e2-08d93056152f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:13.2945 (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: DB8EUR05HT026 Subject: [FFmpeg-devel] [PATCH 41/54] avformat/segafilm: 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: JZNbXvrzTE41 Content-Length: 2545 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/segafilm.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 05b4d9e6a8..ce1166a05b 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -90,7 +90,7 @@ static int film_read_header(AVFormatContext *s) AVIOContext *pb = s->pb; AVStream *st; unsigned char scratch[256]; - int i, ret; + int i; unsigned int data_offset; unsigned int audio_frame_counter; unsigned int video_frame_counter; @@ -216,17 +216,13 @@ static int film_read_header(AVFormatContext *s) audio_frame_counter = video_frame_counter = 0; for (i = 0; i < film->sample_count; i++) { /* load the next sample record and transfer it to an internal struct */ - if (avio_read(pb, scratch, 16) != 16) { - ret = AVERROR(EIO); - goto fail; - } + if (avio_read(pb, scratch, 16) != 16) + return AVERROR(EIO); film->sample_table[i].sample_offset = data_offset + AV_RB32(&scratch[0]); film->sample_table[i].sample_size = AV_RB32(&scratch[4]); - if (film->sample_table[i].sample_size > INT_MAX / 4) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (film->sample_table[i].sample_size > INT_MAX / 4) + return AVERROR_INVALIDDATA; if (AV_RB32(&scratch[8]) == 0xFFFFFFFF) { film->sample_table[i].stream = film->audio_stream_index; film->sample_table[i].pts = audio_frame_counter; @@ -260,9 +256,6 @@ static int film_read_header(AVFormatContext *s) film->current_sample = 0; return 0; -fail: - film_read_close(s); - return ret; } static int film_read_packet(AVFormatContext *s, @@ -335,6 +328,7 @@ const AVInputFormat ff_segafilm_demuxer = { .name = "film_cpk", .long_name = NULL_IF_CONFIG_SMALL("Sega FILM / CPK"), .priv_data_size = sizeof(FilmDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = film_probe, .read_header = film_read_header, .read_packet = film_read_packet, From patchwork Tue Jun 15 23:32:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28408 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp126091ybk; Tue, 15 Jun 2021 16:39:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgD8Bv2JRLoqRYRxjbEJH8UWY2581SSEWgBtI4Hjw1JwDRyUPdjedNYGBV2AkldPdxHpb2 X-Received: by 2002:a50:ec97:: with SMTP id e23mr256364edr.278.1623800362283; Tue, 15 Jun 2021 16:39: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 d7si478224ejo.445.2021.06.15.16.39.21; Tue, 15 Jun 2021 16:39: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=OU3Wwc4z; 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 4D34E68A091; Wed, 16 Jun 2021 02:34:44 +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-db8eur05olkn2041.outbound.protection.outlook.com [40.92.89.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 77D5D689E93 for ; Wed, 16 Jun 2021 02:34:37 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b212Oqgq4BZTCrdEP5VFjgKf+Hc0FfqlDO2Feii1QCuCVSSD+9Jz2HZYXHC8WnXzgpCByW/qIpDOcF1Jitylua04ZxWhcHjwHZWokISNae6Vo115kwtAOjEqof7SLjuSMJ+3wnId8FH9zxDr7Ac7qzjzzTua1llcD+wFL7fA/0zL2PwSSdlZ3Wgr36O25TM9NFyd4P1RzmSV18hq8Q9Be/DVy1ztFS5EIqE9F6fykFXuELlPzdMMCyY6Z+QhkjboMzeDO0qJVs2As6hWM8SbirqH6lTDg4pK2yt3k68kh2rrmLogwGbzeXZ6lF2LjUfbHG+mYS1PXWainTbheHkjNw== 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=XuhJuNDwySQs1WO8ozHvov9EZ6VIyqMWXF5835pQDIU=; b=KBO5QX37DLLhGPsA6wc5bItOSFNEgozd69zAj3pjBS3tei/1f15b2fRy4V+oHQ3LDbkVUlnGxzrjYJnpHR0CppXpACSj23CS8bHxoDGlo7iiAFXo0xR0f1z9Bj6o0VKapl73W1/ZOUKLUctUpLjID+P2uIh5jb4sdSPjKkMuvhOQytZoQwnMcqPwtG/TK3BPnhsX+JtS9fJMaBRYGVedCaPMLG5SBgLKrHZ9wFBKFIC5KYlNIUlRPmtYfJeudw8dnfdsAUEh/N7a3jJSrLBFTk3fqGsQs9fD7uLs2d986W7VGVRhxhEeXMd3Mo5omzET0uy6JSnM/G/s/PXLsPIJjA== 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=XuhJuNDwySQs1WO8ozHvov9EZ6VIyqMWXF5835pQDIU=; b=OU3Wwc4ziQ/FCrlSCB74/mvZXSH+/+Bx5kpZuMHvFCxfFKJpQuQ+X3lJLBWzbD1NkuwY2m9nFwdnvWpkS3BRXSDPQbpQ+1dUPJT1QmfuSlDJzTyC2ar223RtRsw7ppDQR2m8OZQuYRZs32vaQN/pyKfKfxM5f3/aMdMKvbHow3u8Q+gopjxNZBRbqTT5+TXvZlAzL7em/IUYRQ1geEGQHch+UNmiCpPWOVtovUo+oPxHEHNJn8OZRlPHIAkMIKbSCXUs9O/8ql1TINjoQHrxaifIPkAdJTrdborG1cwog9qxUmInZa/jQa81RQjwnYQSyOe3BWcPL3Y3F9u1+SsEJw== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::44) by DB8EUR05HT022.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::121) 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:36 +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:36 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:316A32BF3FDA456256028B589E919AC22B38870BCC1A7CE0E51E582E675168B3; UpperCasedChecksum:89BFBBC1AA35B312FC6F8D47713A14BDE1AD703C4102555E6FD0BF341C160A70; SizeAsReceived:7772; 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:31 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [GI9QngLa4x+yrTv21UpA7Cofkh9+weuu] 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-41-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:13 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 683bb136-9e2c-4ba9-4d75-08d9305615dd X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n54hrFV+Pl7Tba/5V6DR7cwBLhtherAoIKYfmkvTmWc+N7UvyO8hMDxmsiJCXbZ23scRenIRT68/bDZVHpd1I6LoIzz8KgyLNyVyanEVbfa+OGxY9z+OYCsc/Z4IJlTa2LVzQG6I7HUUcClgryobv9Y3yFrnCTfFZbhsikzYWxDaQGNCmLUz4yi5WYitujB00Y96iONltZag35KXf1nWcGngDkj+ihAuo00PZcVQHRahjHHmya0W3PaHVXDl70+QaCq0x3pzan8mTG4Geyl5PuV+mjnqkWT6dwEYG7JD7p9+hiXfxA0ttd3v8trP/uGWmuKttGNFI6rcVOY3zH9pnWc0lsG0Dhocv9WTUsb6BylCLzt7y1aPdQYWirfyrleB3AoNN003BbtO6g8jLVbQsvINSz4ECkbreKQTuT8lmg0xfsuTSEU2blKJnvXPKC4eI0Vb8XgjHYoRAVXp9HaPvGFBKeoq9VcgY9xV2yx+usNhpyXIGmqONV31Ms2xyHMa3VRtTcy+Xs+w2bbPq22iF6WZdTHAkQ0rGySoNzOho/SMu0FKAb6LxlPDiKCMEYjoRrE/Y2WLCzIhtlPDWDCrlOZGepm+Zwuxqgfj4OB3oTmwF2Hc9l69oIBXQ1nFxP2fskYJRfujdkztAmnkjjCNuAcJ0ryMc5Q9vNgw5fYxhUZoTitD1eYSWu/K3RC7m1NxnEpC2NQDrngpm99wwdu30AmHegOB9/JAoc= X-MS-TrafficTypeDiagnostic: DB8EUR05HT022: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kaTPPFBsJxuMOSk93ImqvzUXH2hxQo5v/+Qb2HRVMo1RDdC73Vyk2RG8d9htNgUKz4EzdiG6JCVHL4eMt65zMMoKLkytZEdvGSxgb56IXvdqugJA13/D75NwFjXtZMhMxYQrs5ju/Yhpld6WtXk9GsPvHgaWYlUyGwKb+LShZh4y7ZWj4BZOD9/9DwWziMi8DPnk8rrCmMPWMm3R5atQrrTLQMdpqqdcFgv/0I3blocywxWBNHOY+Vj0WXUcZ1vH8nhyqLtsKlcfOeLIMgLh/SIvVUFJRnhhzO+9kdRS2hK73pvvBBgut6AEhZQIOL42rX7Y8zIvZQorxIl/qxzBXlf2PCqn5xmpvNcE2ZBxaqnEcrRlVlGaS3OqN10WfoeZBISc0cPbK8MDr87Lpa2G+w== X-MS-Exchange-AntiSpam-MessageData: KESNIe6rHOrIZYFTBhA0NE+tfc6sqKR/0CwZ5SUeWSbZIlE7kijJh62KXrRvkw6qX5fSH5ppmrfe0bM4Lz8chSBiJ/PUx7C4hIB8yvyoh2sWR1iM4xaG7ri7E8K3iArpuFVB5yc4k/1GZFJ4lzuSrg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 683bb136-9e2c-4ba9-4d75-08d9305615dd X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:14.4520 (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: DB8EUR05HT022 Subject: [FFmpeg-devel] [PATCH 42/54] avformat/sierravmd: 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: bzpTuNViXHLx Content-Length: 1294 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/sierravmd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index 13304b0596..e35faae50d 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -252,16 +252,13 @@ static int vmd_read_header(AVFormatContext *s) } } - av_free(raw_frame_table); vmd->current_frame = 0; vmd->frame_count = total_frames; - return 0; - + ret = 0; error: av_freep(&raw_frame_table); - av_freep(&vmd->frame_table); return ret; } @@ -321,6 +318,7 @@ const AVInputFormat ff_vmd_demuxer = { .name = "vmd", .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD"), .priv_data_size = sizeof(VmdDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = vmd_probe, .read_header = vmd_read_header, .read_packet = vmd_read_packet, From patchwork Tue Jun 15 23:32:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28366 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp126159ybk; Tue, 15 Jun 2021 16:39:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaD652iQZLrizi0pQAJnp/OZvQJEfTwdCgLi3XjXet6XWnvXwv+RfZ+Pit/x5II9t0oJTY X-Received: by 2002:a17:906:3b4d:: with SMTP id h13mr2023562ejf.228.1623800368461; Tue, 15 Jun 2021 16:39:28 -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 ha1si398337ejb.743.2021.06.15.16.39.28; Tue, 15 Jun 2021 16:39:28 -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="l8Bn/Hn8"; 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 BC96B68A02F; Wed, 16 Jun 2021 02:34:44 +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-am6eur05olkn2031.outbound.protection.outlook.com [40.92.91.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EB9D4689F4F for ; Wed, 16 Jun 2021 02:34:37 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WQXLeAtcgY84KJKYT04ZF38mafUCBSQBXOeKwG3XGWA5VrGHPywKF5ONTY1k08lBf6elvzCIeA/Zsj5kB1f6ghZ5n1pTVYc78Q4UBKhrAfQD1mpY9Bv4MB7OtJTarCMOiX/0Eh4ShL15CSO+swU0x4obZNZMjtk519q9eiAH0erURjhsNODYelY6qQ8sqLTtoAq6CKOJYUTzW2oGfX1ct356Wyb0sE7X6u80VDkTkuC8vuPavmZjuG3ihqWuuaYdEC7p1i2WSVtleR7wPdqLsJs48UVo3vVW1edzkJOXo5sPxw89NzUpIX4xVOt96QbhlEz+IxGrC54RD1SaKMR1SA== 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=HlIeWZxueTT4G12DHFCqWmMekv2+dhH3nrph4+Guz0Q=; b=AFc0QuLSesIdooNfGXHJguSTSPFebijqWiki9XVwwP6wA3sqEq2B4mq3pdfZCJCMf+sc49lZxM+FF8RyVMBnFJY5rXyYmIx7kz2LYrz5TdPjInQwWOlDhs3EGx7rqxI40dVYp0wZtbA+qUXGrqMvX0KWIBuXF53rTKDtukgxIl3LarI+cEokuaYtYbbM8co7+IMUe1x5SB5F0mzahhyfe0DrhhrWY/WgJCPTa4g7TsKFaQWQmQnEiXZTeI1pCggndr3qXuuo4wp3a5EF2Al8/tvJjmSLHf8ddkKtOgMvoVJixFghe+uJccw3UZUVA6zXd/m+6IsVUvlyl6quRQ1/qg== 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=HlIeWZxueTT4G12DHFCqWmMekv2+dhH3nrph4+Guz0Q=; b=l8Bn/Hn8x4djHhE69CaFmd6C8vuQc8w3ZXohGK/5nhhVy71YnqkTHs/vPYagmF9NFIwnhYvELRRPU78Z5IFGCZroAvnyzcV4jHW0nBysCtwBWkySqw2Xav07CZiFqWWRDqrhAEHaF8FVW/c7LRZ4/9RGqly2RVwRHjnF4li2dQz/7zbTpCY6/jteqrOMXdDqubwwkg+uP+4eCssENIOcTHtwoK2D8oOa8HMdsy8uGja/SfuTzbuJPvVvguf2IJUngOf9CVsrZqnw9t9DmVRRndPmaVfEPiG/jk22I09vG8iVI1AUKTP3Ej0XJtsoW6Frf0TEPLv6LGSQ6L6TJLMHUQ== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4f) by DB8EUR05HT026.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::75) 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:36 +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:36 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:46307E50B173965067D54F2F4AA6106B5B5E74D8C8C0561220C5894AD8CD1A41; UpperCasedChecksum:2F1273CDAD233F72307240AF083F7CF6AABEC2D42024F73A57C8DF03E54DB3CB; 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:36 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:32 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [rd6nSYNTIgyb6NFXdCY4FjXOTBOWMo7T] 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-42-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:15 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: ebabc3d5-be8b-4439-a5e4-08d93056169b X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjHWo1aLjbeJG67fro0emgnUgqow8NqHpcVd9JiObgJA6STh7Li4C5DRc27+dTpImkAS10U8fdzl1AxLHViHYLkG1Ni8UuO/PxDOFO4PQZwCbmesiOH8hLrHJYeWwXo8nKxcS6PZ6yaz+V+DxBvSfiuqcAntzCx+hdWBRHh2arfR0H+IcaifkHsIGfVGmwRr6h5G7rCzOEt1DD1L2/Jwjdb1USPiFzg6cFSYkeyUNjxYFg0E15H+p9y3JhTS403xihd5KzBVUFuK46kqbAJISOvmxlXoGCBi5wmrbJhseQl7OedO9U51HDowHi0TvWdsnBabVba7z9tQUtEFpidteTFqBaeBvAFdxngbQfZlfyG4ZVderbupKrIzIrh5zRNeiIlNeoqK3RJxXV/Ar9hGihXDciemCcFiSrLn0HBRN4XTB/99kaInvl0uUiNRIIk8JgJVfy+kwlqF6KBujMK4z13TT3fCa9xdu3Qqw062qDspbSgjAajEVrM9xg4EexAAviZH5YM1bFvxdwu8cPlaU0X88eR5nOOaKc5oZI6tM1gxLdVyDBmOfCfPcMLbHJnmY1KjgTX1WpYRkA1aBG5wi/YhJXdK4EI3EEgCxe3OmP7kgvsKBte86ntvRB2zquHVoR+2iNFc0MPFgUSyadSnDWtBE1tG49i5/w9aAWF5AEmQRtP9hU523fKF9jpv+aB+JHGq9PuGjjfkwyQJre0ITN20= X-MS-TrafficTypeDiagnostic: DB8EUR05HT026: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h/JAqW6h7X8k4UWBIMcDwWm7sVQY82hZsad6zavyGY6Wt6sVZ4P2WRLJ297qaeHyhLDCOVOqld6QAdaXMnEN/9UOexjXiLz7W6//yo5f87JEWxXyZPYzbZ3ToB2eHYOIJoq1brMYuI1/EuS7nn7Oic+dmcVmJzwZui/N8nWGC8UrcJvgE1d0R3owpyUwb0BLHoBOurqxp3gnOv9c3cHZwh0XNkxSthMUzgO/pd1z1JOCYjGGz5dT7yYP+LfmN+KaUNitYiD4U/WP2A0F0J/lJ0qlCnXPAvbygZO8logCUnaLalmcLPtMN8qHoF/YkXGp5lDCCvLCUEHJswIhVuP1dWFNuseHCe6vtY3VV9Zw7qwZT4+ckq8ihpvZv1UdTKMoHC4aTWZrf2XjoJsnMOqInw== X-MS-Exchange-AntiSpam-MessageData: qmXkoK5qJYdxA9Ji5uFNYI3n9aNNONzpYm6nV+o3MPr/LNsy083xgiX10tnUjDT/7YcPuYL4Mp8yDVIYkSUJilXNL1QEt4Hrs3ffH11zFw81+3yIjYjnPg4gqsZLQ5hAkmvkTiZNLMoFyRF3A9wOVg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ebabc3d5-be8b-4439-a5e4-08d93056169b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:15.6994 (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: DB8EUR05HT026 Subject: [FFmpeg-devel] [PATCH 43/54] avformat/srtdec: 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: f8UnDLyx2KGW Content-Length: 1181 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/srtdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index fa52b85566..2f8a677b9f 100644 --- a/libavformat/srtdec.c +++ b/libavformat/srtdec.c @@ -207,8 +207,6 @@ static int srt_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &srt->q); end: - if (res < 0) - ff_subtitles_queue_clean(&srt->q); av_bprint_finalize(&buf, NULL); return res; } @@ -238,6 +236,7 @@ const AVInputFormat ff_srt_demuxer = { .name = "srt", .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle"), .priv_data_size = sizeof(SRTContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = srt_probe, .read_header = srt_read_header, .read_packet = srt_read_packet, From patchwork Tue Jun 15 23:32:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28371 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp126281ybk; Tue, 15 Jun 2021 16:39:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt+hmjlkIpOgCkvJylUf+ZQkRF8qsrxZ9ExXv7BKUfPqFJjjj7h66DqScVqv+ftlUYU5Lo X-Received: by 2002:aa7:d5c6:: with SMTP id d6mr701311eds.290.1623800381464; Tue, 15 Jun 2021 16:39:41 -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 16si393065ejd.349.2021.06.15.16.39.41; Tue, 15 Jun 2021 16:39:41 -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="WJe/1LU8"; 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 16B0C689985; Wed, 16 Jun 2021 02:34:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2099.outbound.protection.outlook.com [40.92.90.99]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5D517689F4F for ; Wed, 16 Jun 2021 02:34:38 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MAkkWxf5Kc1PosppEzCW1KPFwFdEXTbKHCEX9zCR0E3v8jLYvPxBMj7Ht73KeF1wTnYfXRdT6gtkot63hRqhgeWXR4wGehtxuUHh2CES/tjFSfL6ex5tZMUh39hjDynYnwBwCLa/+U+rkb1sjPqZNB9YQHjR882B1g+gFzwCmOa1vOQlL/vc03+vI2mlLkF1kdMBDSU3VszxldAVxdptbx6fccarVu89+RgXpDLu4/nx6YgYbkZ8ZpJ+2PtXKorp9xfR15SyxCt30vqaANv38+zj2LvY74Q4STPyMwd96sfIZKr1i+SLCnDulLSpRvAX6BIN+O1+19QZQn7CnVlBVQ== 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=OCmoiCe1JhEnyAd7CK1dSSMlnSdEfFWhLnVIPL8M6/M=; b=jI8M84TSpVZi9QWR0EGJkKj+wv/VsAQi+Wr5u2+rO22ltWF9qWQvt/ctvow+bNHLx1xby8Zs5+W2IczzfQsrZPQfNNuN0KnZWIKn/g8XKaXarCyhAjYIvCs1oDTz1XT6VwcI74KZyQVQWi2tE7/qvwyLl9qwG6J1RiERzEqg9ljpn5yvGMZ+k4pDZwFygMZq1hg6ZgfFVLAjiP1HkUIqGlKJo5WPVUrCsurK3iiMi7JmxfcO7vVRygjtw8T2KxlUylI9xZHCIOPLoN0XAiHcwjo/b4VG8XIGnzyForGepxpCrkvPs0IkPqeGCm0O/RrmEqAT7ewiwqrTDgjci4hj0g== 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=OCmoiCe1JhEnyAd7CK1dSSMlnSdEfFWhLnVIPL8M6/M=; b=WJe/1LU8LotUwLwqcmjKqNjcp/d/h0ol6gG59Dh8V+/ZgxB+ZP8Vonndz+xqftmiLR4oGitH5uLvT7N7uYIiz8YA5w2nhYnzZplfSkeKqEtbbFyqrxdvQJbNpcfmLFtgoG19R44qRv+4E1l/Gu2R/QMaYTwXDUk2IHVvpCI0h8h7v+HJnKME1+5AnuAUaUq5UxCE3x1I1LMq9e1d834yP/vuzuA3c+twhKyXIsDFcVq9fhktVTaR3wy8l+qXLewTeYVtzFOFRcgTbputTHGf83aNt6VE5PrBCwahuJH8iOKuAoBTPzJwL0Xehyov2v6p5I0H0MTU2Nw/QX2WpF+Pvg== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::45) by DB8EUR05HT120.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::466) 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:37 +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:37 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:38DA84F2358B974C5BD670F5061D4B5D2FE4E0206C90988D6484E24CC11EDF32; UpperCasedChecksum:11A882D3C204049D8FD7DFB1BB4F044152C526BF049CAEDC129E713D15EB1DB1; 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:37 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:33 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [S8kLkqGvgqhYecRKVPY009uldRNl69F1] 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-43-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:16 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 84dc3b86-5924-49aa-b0e0-08d930561747 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjCyR3nvnqtBFob6iScERZNbTE39jqKA7JSldCBHGfLgVjIyIBOMeIDk3z8BgMcM+9HH753bE4RxS/FCPIMd3N/Q9tcSWVmluOX4hsSdN8xncsXJhPwzGBFI2243O3et5MecE3+oM2ZR+xQZBirGjqpv8YDdjp9rc8EU897I/YH340LP5ODD59p6sZVDkiFBCsEpeeRuPFA56JYAfVXrdV1TDRHWa5B1/7A2vwZPk1Z1wFN4YDyxZg3T2AlcWO/SKKA3miLDvELfbiAswNSGhnJyBjWT4ejROf0lJVjOTgKHYNLZyJuxMMfWEg5mYxgsK/NPqSNFXKptm0jMv7wEn1AW7ELbCTUCzbMVMDHBhel6nMCBHuu9kL8X7KPze66w5rX8+KprM41JLzB/ApaoZKXxJPWot4hORKHXxb1SPNao3ziCvJ3h1562/MNae8v6UwXTlN5qqEyIR3TbOxMEAB543n9z6nlu029r4WtXFyYBVqnfYIaFn8oM0rUJ9Ybzfrgj1KkPapjW06/iVvcZs1RF1NoNxSaH8Fs/OD0laMwzw3z4+OKM4zhJGvXsvk+SZK+DFn/CeOzFTUJiYsG4hSVztjG1T98rOueamqjTp1Ek0zpkGcec8KSsmZuhHCVH+TWreCg9WhZtEmDDY5nTskIzbDqWisgUSKSW+ACsOzkLutblKeyxmUrhwoopv7cDFB8wzhiTdDXULatFsnpQWw58= X-MS-TrafficTypeDiagnostic: DB8EUR05HT120: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WVQwCXrLOp+mPaS1nsryyS2Nq0NfZW6bfjmYNk7bJ15VKyxdf5s2r2jJ3ijHMXqxslXUbZa9jiwkUtREqkb2nGNLTAZvqmhnyCkNkZ/joYhJKNXLoHUX2kyg9jXomIcRA8J2qvhxx+sv1WjDDl7gGTMCAjBdIH5zlpjMLKSsxHNorcxTRyxQG1fKUUKNr2UcogmPcHXeAr3jD/X8zTUvQ9crOvlee6Yx3dYIfJ6XCr0xdwtTx5TxuJ+Po0uja8luhakBXwS8La+JhTwQBR6n328suJT7c4qGc20x+baoSDPY5OF4xyMN0m3iXrFF8+5P0ebaHnxA+ZOQAf/qxf8TM0YzX0xkjjAb9lZtMKO7k5DehT0pbg6VGaPPyEDZVmXs8OHuHMqSB7Xz48OLccJeKw== X-MS-Exchange-AntiSpam-MessageData: wXvkjWxH/GRXjRQoYdblot5QrbcV1AoG9uuoykMscOVxhlnS+gxm3L1bQj4MFShRitw8oXUccDHNZjeW7VeAFOLDyP16qmr+uNiHLrxe9ptejgbra29fZiYEjuLNjJ1LfM6u6eR09yCVrrt0ULhJNA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84dc3b86-5924-49aa-b0e0-08d930561747 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:16.8329 (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: DB8EUR05HT120 Subject: [FFmpeg-devel] [PATCH 44/54] avformat/stldec: 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: j8DWFVnE+ci0 Content-Length: 1435 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/stldec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/stldec.c b/libavformat/stldec.c index 7b7c98577d..48e18d865e 100644 --- a/libavformat/stldec.c +++ b/libavformat/stldec.c @@ -97,10 +97,8 @@ static int stl_read_header(AVFormatContext *s) if (pts_start != AV_NOPTS_VALUE) { AVPacket *sub; sub = ff_subtitles_queue_insert(&stl->q, p, strlen(p), 0); - if (!sub) { - ff_subtitles_queue_clean(&stl->q); + if (!sub) return AVERROR(ENOMEM); - } sub->pos = pos; sub->pts = pts_start; sub->duration = duration; @@ -134,6 +132,7 @@ const AVInputFormat ff_stl_demuxer = { .name = "stl", .long_name = NULL_IF_CONFIG_SMALL("Spruce subtitle format"), .priv_data_size = sizeof(STLContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = stl_probe, .read_header = stl_read_header, .read_packet = stl_read_packet, From patchwork Tue Jun 15 23:32:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28386 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp126341ybk; Tue, 15 Jun 2021 16:39:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsjHeUzb13KK5RGBA9zMwSbw/dJYB0IW6+UxpPLxMBAkle0YCQBseB0MCiy8egZBynhM0o X-Received: by 2002:a17:907:1c13:: with SMTP id nc19mr2053223ejc.168.1623800387624; Tue, 15 Jun 2021 16:39:47 -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 m7si297749edd.133.2021.06.15.16.39.47; Tue, 15 Jun 2021 16:39:47 -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=asIq98RT; 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 8F86D68A0BB; Wed, 16 Jun 2021 02:34:46 +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-am6eur05olkn2107.outbound.protection.outlook.com [40.92.91.107]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D317068804C for ; Wed, 16 Jun 2021 02:34:38 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nAnqLbUb2AArkSJZmAELWKgYYfR5siiRI6nxvE/kAx2iuIq8eVPVzFKjY0Zb3zLJQ0XNzmTTo2lYOdrHfVjeM0w4mOrYgX7gsl2vbmE+qcXxfuandyXoiV3kbqTxeuJxf9WQMTo5KCzm4e0JkAIHYE/iIf3LpOrGBlyV1tsJu2TFN3WnYYtRwhBTDc0FyHXGBc/HZ9AoE/DfmNTWzaOjpckuJfIkDP6h/4eegxRyPF3x/FAe6istMvUftNmea7k0q3cGqq5fls4r/TV5I2JhvGR7teY1Y4vWcaon1a63fHV3avJD9APs+h8zy98F0lLAFbNHACV1hhy1A2DjvuMxTw== 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=ZUstnRB5OjJvYDMjzO0QddCF8Fiy7WJxSnOs1o8Qbt0=; b=bBzj2HyHMJawIFFNboFNoUyMSBMoAEkiczluuafsIQ+vmCeWIjJ1ULg9J9QosvVG9oZpFxKkgXtbXHDgldzsERitbKVugjx1JXIZmMsgiiD8z5uLsVH+AiCEb830OGsemO/qzdILs7vaSEx43eVxOWVrMhuwcdEVcQXz0Y5P+/vQP95yf6Hj5MPx7FxCwP+gKcggTCVgA8BHWm/wzuca+1j48JK9d9rNSR8FqNupu3+fSMXSHwL07Q7jLCQ0AAGwWmDfDnD97S7DKG3QPheUc5Iju4Nk/omffp0CLHoQm/nqF9sT8lJaArUKhuj8VMfrCLcoQH4T9MFk19I6MkHb4Q== 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=ZUstnRB5OjJvYDMjzO0QddCF8Fiy7WJxSnOs1o8Qbt0=; b=asIq98RTOoULe7IVDrcPEw5TYKHI4xOQOZNNt6OE4dEx7jomxdz+I+FhKy+SZbckNKmAY+E7czvhXMYXm/rCuTgrhUeVo0nQYVp1d6XGufhiACzEZ/7ZJnOq4y91sQ7OX61O5YWE1+SMxlzE0afo6dy0fzmhMBWtzua50PcVS5uhZX/X6U/QyRToRwA/YlU0AzumMqD2oG1Gx2E7MRaB3a+sQ/RB228hJmWdbUgs635MsvReSwHOJGZvGgqz2zuqbGgXbgt98yObvP5L6qwAMY2dX0ST9mmCB9uf6WK4EqTpI01Xlq7p2s8hOvXMblbnv3aBz0DvN8bVryBwIiEMpQ== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::47) by DB8EUR05HT142.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::315) 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:37 +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:37 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:BD5D6199FF266773A3834FD9D577A7B5720389655BA46B85BDCAB14581114919; UpperCasedChecksum:A29650F968A13D9C8320400C77F4407ADB39E7E3E7DC250543A54609399D0549; SizeAsReceived:7775; 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:37 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:34 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [03s1VLu5LRTOju/gZh6Kq897zZj7U4vz] 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-44-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:22 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: d971783b-b0ae-4472-c237-08d930561af2 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n7LELivV0hd9xlCmlOveRrS9yaA5ybV4QpFYySaMyfDM5fLP66p/gAZUo9N3b5sETK/w1r5foswU9/8Kv9YLB4Zry4vRn2uvst71abVIWvPSr/OkHUegqrkYb3gqOUsBpTYXPWPAg5BzOUqfSspeugiTVmeks/giC03/rumFiCSqKuFNDn8MC8BewH0WTMNNNr/4FNpVs/7G9qORVYhJWU9sDexaPcZr483Q0khy2VmTyifzTUdnemWz9XdDnDPjOEA1TL7ZFGnb/an6pc6DTmR8JRAhRKgqTlrGVo/o4j6YMZTgIVFDQfwkZoBDQ7yGJmlkojsNPD5/CK/cz3hRWYzwi8GZjvGKdbBgdDPd8EujgKQAKcGzD+hwEmiCqVmzK5/JJ3Ppw4ECT/JdK5Xr4pxPTUwwa3xCTC0LOkx7IM3fSH7X+/iReabovyvkQvGFLttyN6gkyNFTEzVRBnmS+oX0AESr/kh/cSb4HfwT5tOcI/qdXTZ+HG3LDAZ8CxU11+6v6YvMMlod6orzR6qpghsKhWAV4gMmswTXysAygH3I9uML1XgduVUavd6uKSMwquMoI7tdbn/wChddZHdK0PHfdn/P84I/fnGsuNdtgBi0MhBYkokP72ByONad5q3e/PyJVEzsSSzSYDFJ3UKCARFOhCl74MztM5J0jVGkwv6Mc2ZCRrYS6EtoeZvIfd+Ea4UmAnrzclEU5yVjfywvqP4kYr1XQgAke8= X-MS-TrafficTypeDiagnostic: DB8EUR05HT142: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UstwVoroqaxBd6d0S79GkX9r/9ZnhO8v4dQNzdY5bWqo6iiRHSlJ3qoQijlbtSW7Uhx7BfIRrj2AYj3Y0aqkRYZcDxAOu0Y9z08Ki49MkYagkw1dA1t0JPNexKGEjarCNARWOBcp7r8SlWt2tcIFHEcK+kPyOdkAVcAQigQ7b6W+Bg73VL6PHyRjbWR7talxtZEaOUxRCn03AvlwjwMVdxFnUHQ+d74CIl3vAcRgolaUYJXL5aL7Qpq/pd1tHyl7DO90heQWKGoymXrBDQDCQvd+YZcX0GCEztsqjN+kgTAvu4H8SHkiNJ5/sqjLrobtIs9aTnVfauhjOvQp9cRYYVwYaMlC34ckqjYw3pZ9VU/mlq7kPGRavu5PPPBw2gjWHKHIk6NyqkzTC49RCO4LQg== X-MS-Exchange-AntiSpam-MessageData: t5fCnnJjwSUh6aUvh8FRJ/XrstAE7rQrrDRc9fHBpKlimn7qdM52jg6OEysSBfQv9HzEpotBNFqOAABo4+5PKafpq9xxvd0o/yqLDqLmDftfNYrlFduhZq/soHHZXuAjm7Aghr+9qxLOmpSj/f/xQA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d971783b-b0ae-4472-c237-08d930561af2 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:23.0692 (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: DB8EUR05HT142 Subject: [FFmpeg-devel] [PATCH 45/54] avformat/subviewerdec: 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: UViU0GOaqCJq Content-Length: 1293 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/subviewerdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/subviewerdec.c b/libavformat/subviewerdec.c index 9bb7728407..2ef3c088eb 100644 --- a/libavformat/subviewerdec.c +++ b/libavformat/subviewerdec.c @@ -176,8 +176,6 @@ static int subviewer_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &subviewer->q); end: - if (res < 0) - ff_subtitles_queue_clean(&subviewer->q); av_bprint_finalize(&header, NULL); return res; } @@ -207,6 +205,7 @@ const AVInputFormat ff_subviewer_demuxer = { .name = "subviewer", .long_name = NULL_IF_CONFIG_SMALL("SubViewer subtitle format"), .priv_data_size = sizeof(SubViewerContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = subviewer_probe, .read_header = subviewer_read_header, .read_packet = subviewer_read_packet, From patchwork Tue Jun 15 23:32:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28420 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp126460ybk; Tue, 15 Jun 2021 16:39:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwgAr1iR9/29RM6O9CUUoISpCfSjrkQaGtCSBV8JbUx4y/+VPR2Unmw01Qd/va4fIXd3wS X-Received: by 2002:a05:6402:254d:: with SMTP id l13mr716928edb.286.1623800398102; Tue, 15 Jun 2021 16:39: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 23si478099ejg.6.2021.06.15.16.39.57; Tue, 15 Jun 2021 16:39: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=AsjTX0nd; 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 E71F868A107; Wed, 16 Jun 2021 02:34:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2041.outbound.protection.outlook.com [40.92.90.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3532B68804C for ; Wed, 16 Jun 2021 02:34:38 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ODNz6/9kVP+rP/XVm54jKsvy4FvAhCYyjiaXcekrx6uaiiSCleZ2PSw5P1hJ2nXxkrwWTAO6bZ+r0meORrdlZCnU8lJHY98NNfa42DntoCU8vI6UXeES35UkEGzdduZb6+6f2yvdv1IOmx6OKYCWy/ZxaQPXCtDZYptLv7oWcn4j+0ut/R5UQYQiD3lXtT1M4n5qRRa1ha7pRYDQ5xC8PZR71j8Jv1Z2gqIUxpqXf3mYbYyCFJ480HB/rbbUTRBXGensRIBHfyL1wkhuwIzJ7h+j3ne3WPFYmNeW6sIJQk5+REkJysXpzjmgzHaqQpPYZUm+d8xSusDL+VO6c0Iy3w== 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=j61KLlIrBi5yhxyc/CO8/i+33EDe7l3vracCRU/Abs8=; b=MCxlYyNCgyBwi0Hrarmx10TTQfsxCaSLaly1vJQBxdJFwASy0fEKlVVX3OjSI50wRpyP6gZI2xWKKuznXavbwAxU9Qf5frfsHNXwHqpXZwtDDFIgjy2xGtp94ufn6Ldc2G3bgi1cp1oP17d/VkYMLhSDhB7/O9jB8SVjUNgA+kvdONcEvUM9XGJKNZ7PTxKrPfRXZjJ63a/1yxVJwKlaaAh18XruTKWT+giqIHGuyFky2R19/P/3VTvZehBWflHQ3vCNKdJ8ztu+YuZVkha0LFnEJAli/TjiNxZqYp4SSi+2cFJaB+jJEY35K5tVbyU+JxUmg8PmAZLd13agNLYO8g== 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=j61KLlIrBi5yhxyc/CO8/i+33EDe7l3vracCRU/Abs8=; b=AsjTX0nd4EvW/B5Lbla0GhDjvz2JhXuIdUpTWlV/UlT+KORoiyQtZSMimuuCrOK+71F4I+T/6dfX2WqLAOufoiPojHJtvrlO9Lc3U1r17ih4YuxA8N1YRe8Qp6FFGAUGbNkapLsJQP1IyW50ShcucHudqCUxNsDqYutIRi4pFkhpK5nW9ZRXPHD+4VnCHemP92l/ynnu6f/cCQaLfY1Z1Qurj7gCC2/HA0QAX/3GYMmXnV389fBS3/8Wyu46mP+JpZVmXiDaOOCt93Y3uWLLV5Jt51xk+1hxpFvtWn+morID4vOciDNsnsIHOG5qa9hzFcbd7rCLilYWrsNBjwPkQQ== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::50) by DB8EUR05HT019.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::421) 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:38 +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:38 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:5A2E43836556D6FAA9BE58FE4749D112442607938E06F62F25C809E182828E31; UpperCasedChecksum:7C5DB10618E61137D8E13D367EA10CEC0EC910DF2FCEAE398DCB4EB9BF278C3F; SizeAsReceived:7775; 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:38 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:35 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [Zun1AnLkfXjv/HhJsy2TakiIaX9KMyp/] 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-45-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:23 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: dffa4f6e-3fdd-4c99-8e79-08d930561bd5 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n54hrFV+Pl7TUq1YDfqDj3Iky3SuQbnz3lAiEw+LWe/PlmSnQAK1igPeSheVbrKmvI6fDRRw78rwyFj10PaQDvsWKx1+fcfAAYvM39xQzy+6RMliwlNtoLUwtcoC/tsU9wPkGGNSSOhx8p/H8JFy4h4Kk/cY73O+/OGb6sq9N1FtVAvqVksqNRBWOu9/U80sNV4Yv5Apx5kG6q4Iyan1hYC7u89P8lndkS0sPeofWXWrpfvkMkzcfytg6GyMZZe054qu9Z/DBmxUtNc7ygeJ9qFkplr1iI3WK3aZaDsPizp5PRQ1AuIKbTFK6D8d7GwcePJziRrp8EiH6xJ1xH7r3ad7ru4PSzY8wSNOGk0G3xihm21AvFH/khjzl1gf778wJ2jfwaiC6KXajtoZRuGmKHP3KerMwCVdeRdlDm0i+GOlIpOwQVxfOAtRH/rem7AVKUQQAcUACXGcwobRus7yXEDuFoCTjDddsYwpQcDKJT+9KdYeEjYRT8DdeNHLn7Hm3NtguRmkt2oo83X0tUH5kdkoas/SQRuUMjsqoZlRhcL/Eu4R/5KzYbAhJzpnYr656lH453nLtUkwEdPY2Dydo0IOqohlRrB6/yyC+UPwjte9CWTEd51Q9Zhl9sYvPBwsxAOriHZ07e+rO6jtpZE320H1I6KiUJX1228a26r+Hbh4WtmCShfC3iewKQwZCb/w1p9J7pJEkoOQcHQpGEvyCIVmZkluDANmOM= X-MS-TrafficTypeDiagnostic: DB8EUR05HT019: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J64FKd6H5YFhbhcAbu6ClEXKfHxMPuu0D3KgXJsDlddXxcDTxjS7gX3t6SAyk3/0veIcAUlD3AWT4FClimGYYH5ArGmyGW8SdmfKdcGKha+E3B7ku79KfpkatC0JMT+kR4zI+kxw0rjBZ6ff1d02DBWMAseh/mBGLUuXwQO3wkap1hp0pxlMJK1LvsChvy0jh3AjjgZcrFeuXzH/cGObv5JQnlYfLW3cKpOowsMA9/i1Dj30H5UR1GdPmicpdnibpX0h0ytrmw8dYo2Kxtg08yELPAKCNqPykiJoFZvPjBMr4A5844FkqUxJnim6JfEQwuTnvLS3eAZjK7RPlui1+8jqqzCJFbcD6+vVkwJk/qY3nW/lJn6dISDRMQKKYep72Z1FB5n1EmwSXhtGQPgQow== X-MS-Exchange-AntiSpam-MessageData: 2mfT7IEuh7f2sFFTbHt2QgRBpqmPzAPc1xdr3WEzCZeT0d0ZsXKeY+SS8AxNtIiIyefzWON6WsG8vMAnjLf4a9YxQKr1tkC030l9HSNzYGtfh7GZS7i1QS3pvlcMH8Vn5CKIjxkv6QUpwiUwBTHo1A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dffa4f6e-3fdd-4c99-8e79-08d930561bd5 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:24.4006 (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: DB8EUR05HT019 Subject: [FFmpeg-devel] [PATCH 46/54] avformat/subviewer1dec: 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: s/NTavCohkHb Content-Length: 1575 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/subviewer1dec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/subviewer1dec.c b/libavformat/subviewer1dec.c index d1ba99f984..f1267031f8 100644 --- a/libavformat/subviewer1dec.c +++ b/libavformat/subviewer1dec.c @@ -77,10 +77,8 @@ static int subviewer1_read_header(AVFormatContext *s) sub->duration = pts_start - sub->pts; } else { sub = ff_subtitles_queue_insert(&subviewer1->q, line, len, 0); - if (!sub) { - ff_subtitles_queue_clean(&subviewer1->q); + if (!sub) return AVERROR(ENOMEM); - } sub->pos = pos; sub->pts = pts_start; sub->duration = -1; @@ -117,6 +115,7 @@ const AVInputFormat ff_subviewer1_demuxer = { .name = "subviewer1", .long_name = NULL_IF_CONFIG_SMALL("SubViewer v1 subtitle format"), .priv_data_size = sizeof(SubViewer1Context), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = subviewer1_probe, .read_header = subviewer1_read_header, .read_packet = subviewer1_read_packet, From patchwork Tue Jun 15 23:32:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28351 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4314461iol; Tue, 15 Jun 2021 16:40:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKkBcQkKszOgn48BiwQXdE4cRvwOXMqLXFR8PmiEScWGSSQnbhlkpRsecXf6Kz4o58NNTn X-Received: by 2002:a17:907:9801:: with SMTP id ji1mr2070831ejc.523.1623800409842; Tue, 15 Jun 2021 16:40:09 -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 z11si391703eja.613.2021.06.15.16.40.05; Tue, 15 Jun 2021 16:40:09 -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=A9d4vlIU; 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 965C6689F20; Wed, 16 Jun 2021 02:34:48 +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-am6eur05olkn2102.outbound.protection.outlook.com [40.92.91.102]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A942C689FB5 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=N+yS1RtHZm9JpYVAdjsk4INyA60/06lHF7jEaiyjGAdVBlmsR9jCFfFzc3Tzn7hvrwp3w0j/qgMkAy/l8eDTPM8dqd7YM6fxIpkxli+10XHdNKIBfqSlxm8wsqG3KcH4TQ5Z9p/nCKJ/lIrZY7WUotMovejxbhtZLNM7+Q1aabfKhQMQv20lnp+V5zvBHqgFkYD/P5Bm5xoYpUFzW5k9eyFta8oKd6SD/jFgOzaz/A+sAlxVp+spMHZXWyhdVna6NCwHgKK+3Tqkd26BtmSRSmM1TijdNkWyZZtyTIFLpK8abX4/RHwjGJzlY/u9MyKMUAzoQa/pzBVhZPSswfuqjA== 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=aquKw18N2wJA1njWXpQP5FuxitXcW2N0y3/KznXXdH4=; b=at8OPxqnp6/dX3dXhZO8uFatrR0Pz/QhtCFoKt+8EnDqnAWidZIaSwHIWjkwWrQgE8xm8p5+QsaaDXwTBVeWjieDyrVn97eTmmW0GxV28VnQFr9rc0KBbOcLLBOaq711XLZZxEHL5jAnYlKcaA23N74oCY7+CShpkttTkApnMsznW4rki2r+SszwcU/ofS32wtLQzpJ8VdXS26Xau2I0sAicdgi5ZUqOkTHHokcshB5UQ5bMvYVjk+1Gu1BFMuM0V/0SSJr2HpjJb5ao/rBWe8MwdgwXFcY7jh5cwxq6IVd4leMSN5sy3eXNaqk9gdoWGffNUu9NbocCNO2uAxIDMg== 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=aquKw18N2wJA1njWXpQP5FuxitXcW2N0y3/KznXXdH4=; b=A9d4vlIUT6z02pLXd2JiGk/bAVduSS+S3b7gOmb6N8tWuo8YO68SBSkBt60c6LiG0HVXanyIvg2UKgIp1eEDlRJivD9+0ZQSA8U3b8TvnL8BquBwLE7yYhpmIS9z9xB+nJz/xQgicq9g2/9G9j7kDHOKg/3Jst43eyacNO2/P4Shkp2TsZCMiN8Ql3shLtiVl7d2ooWBCilERmCkZA38c7ftfk/0zZUfCORU4w6vn6LYd+IDbi7vsKuSWcAudvypHVYfXUJT30WGszxkrrh9E0c4qB0PI5+/AER+NOq8/j1i6aAcZngopG/aPoN0ZkY+DqwYkkw/m8r/pXgUF6AnWw== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4c) by DB8EUR05HT034.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::163) 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:38 +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:38 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:0554568C6EC838773217FAE01A42330DEBCD651DD05B15D03BC1A5BEC8E98FD5; UpperCasedChecksum:5FF173EF0C4BB583639EA9FB82B98385D84E427993B7210399919DFF4BDB0AFE; SizeAsReceived:7777; 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:38 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:36 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [X2knRm0bUNdAras03P2XFYmnTqqZYHgQ] 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-46-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:25 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 9852035e-bb85-4600-ae89-08d930561c92 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n54hrFV+Pl7TTCM1osBJJoYbKZ+kgnMjWPE2uCufivMiW6/2Ctc1g/T2x1ioi89Vq8CPGsJABq4UGJ8VZFiw3Bogr5qTouTnA8XGm1HaZzxHuq/J2wkunudrKj7i2Hf8CQNvMncioomytSE2paNANcadl8Sq7i1X8CFPZCuhK/r+5l3aeKynRuymRbjqBICTFU3HEYTrdKmlUSSzgMcjkjc2PHeH5Txr1FYhvT+wJT0m10CvJ6JovDVRm38b59FUaPpCnzvf9bGmr7q+ZMV3PAyH7ST1HomDXrvKrulOFbbLSxpYxWYSiCYfV6uCSmbi0Rezu7M5Z/HbOHQPiq0Pf5X1JaI/Iz4FS7zxh6TtJFP4UqbqF9aB9Ba0gBoUdiHxRzimqEQzdTg4rxo3afA+QPIAe8HRgopS4Tmrb+0M1r+6Bw449GbqRAAhmKT5iCf41claSdTlIzHR/SEN10R3jPZBfM0T7MeND7Aoop/+eKTfbj1Kxg68s7lTFVLrhZ9ArItXUwqsSL0LfJlhnIm5SqmXk0L+ZKwfHAzxZesJrWDDsteXm/8zXbHk6EeS1RW2NNZZ8bZzyQIgzKcktLOsZOi1NCSTxyAzdvKxsRBPoP7R4RsFKLqgcnA0lJ+y27xEOk2okzwmI//6LwPmWKpldy5QxY9/rvNTF4POImH34efVYqNzlcFUH263cdYr+uPRUtMkq7FR0iJoo2glP0BpQID/AzRuajaxgo= X-MS-TrafficTypeDiagnostic: DB8EUR05HT034: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FdtXjZ0rfPXxff4AiLRcSdZkvMJby81Wj36FgpRGyvCf+Uu7HDc6zegdxYOx6/LhnD5J17ErRdu79tMn4D3wlffdPowQwgkhi9tdhOVJqAxmqTPw79mAkXK9wJOGIoAZuNl7vOT8qZE9rppsAvwvZz05hBxKtv6E94TPL6vfRuy3SjPLoCyPHgUTf/zHoHernwzi5jhwFKotx3d0b/AM/AEro3teDAoazVWi3rMTmLEy4f1QIz+O62Ze2gMwZB1E5qdhP3vgNK4XqFKBjyocegKBraBnHP8TLwTuWtCSCqwafH7EqYq05Pd2RRx92ZS5nw7ujgFrFFCqFbmqax2PI7LjCos3dPjsTEby6cJctlLjBsuPC2cc0ismUUxPpBpVLnoz2tgMYs5l0DLaLcErvQ== X-MS-Exchange-AntiSpam-MessageData: jXgrBCwuDoRV3OiYzUnmy60CIu6vxx3Mq+nCGEIZUi4yt6loy/wLkp4ghUSb62dpaDre2fAzRZL8hKRQrf2aNJ54KAU3T9p3KFLBaw60aLjPpDSzREv9n1sPysMLcJsyUKUzNgM9G0fcsP35xpSjuw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9852035e-bb85-4600-ae89-08d930561c92 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:25.7210 (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: DB8EUR05HT034 Subject: [FFmpeg-devel] [PATCH 47/54] avformat/tedcaptionsdec: 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: Q7L/jZA8szQn by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/tedcaptionsdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/tedcaptionsdec.c b/libavformat/tedcaptionsdec.c index 8bebaba5c0..4bf93e26e2 100644 --- a/libavformat/tedcaptionsdec.c +++ b/libavformat/tedcaptionsdec.c @@ -288,7 +288,6 @@ static av_cold int tedcaptions_read_header(AVFormatContext *avf) if (ret == AVERROR_INVALIDDATA) av_log(avf, AV_LOG_ERROR, "Syntax error near offset %"PRId64".\n", avio_tell(avf->pb)); - ff_subtitles_queue_clean(&tc->subs); return ret; } ff_subtitles_queue_finalize(avf, &tc->subs); @@ -358,6 +357,7 @@ const AVInputFormat ff_tedcaptions_demuxer = { .name = "tedcaptions", .long_name = NULL_IF_CONFIG_SMALL("TED Talks captions"), .priv_data_size = sizeof(TEDCaptionsDemuxer), + .flags_internal = FF_FMT_INIT_CLEANUP, .priv_class = &tedcaptions_demuxer_class, .read_header = tedcaptions_read_header, .read_packet = tedcaptions_read_packet, 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, From patchwork Tue Jun 15 23:32:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28354 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4314633iol; Tue, 15 Jun 2021 16:40:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4Q8fLb6V6Gr3Mn0Ksfv6UsiMoO+iS+igRZiA247Lt9Qf1U8yfvprmEghYheHtW7d+lRTM X-Received: by 2002:a17:906:b06:: with SMTP id u6mr2155031ejg.199.1623800424271; Tue, 15 Jun 2021 16:40:24 -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 g17si481451ejm.627.2021.06.15.16.40.23; Tue, 15 Jun 2021 16:40:24 -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=Wg+Y9Bf5; 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 94882680231; Wed, 16 Jun 2021 02:34:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2046.outbound.protection.outlook.com [40.92.90.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 810E4689810 for ; Wed, 16 Jun 2021 02:34:40 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O7mFDo3vMewJGSJtq8KlGX2QYMhlI5pBYYbWHWRNuK37WrI9fg3YqgC6eq1m8h13mUMf3ymmy2VaBa4+Pd2cCElvBIvT4p9yeEsAVuLnWE4ADSLXCm5oXwVyrsIK8xeeTyyRJxeduBF5uxPc5ARemyOma3x+5o4NwQQ4/0MMK9tn0TvXpW/iEO+122GSHQBO5qVlDwt615lITAG85CBAkZ7y+EdhHqnt0OkGN64N0Mgw/WBP/jcPcMruY/s1jx6JvTIThvOER4Em+Ji6xidT/WgZlNEeAyBZGtK4p3YdxdDWEkuAapa1maFuUQRrqKBUSK4t1Ua4pVnVud5xL2pWdw== 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=8FLXAzlfRnqpSb8fynFNIq1DO0PT3dOLJt7TFCsMd98=; b=gEQDfXsht9WFndDB1vXox4/IN+IyUdG4aKZ8L0zncduGtzPN+wygfLSMqt3yFF5lMjyFFxPyJvYUkletdtL0CM29O4MgYsKRAMvTrSey68G9JmUCSrNX2yeU7GGQn9niR4ZMRrOY9ep7EfJDfppohi4ZPIGpnHPyifcGHZ6ABo5gTXKB2xozHeZI5D76XEKfnWTkmUYitQJsBeHW+NC4Zblrn3zE6TaWUyslX5oxvmFMakkSHBqNr81eF62+yJz6t1jfpYyOpGgCRBXe79cgyNU4f1FlPhYzcd96JyEUI33SDbFOxH/0HkJubPsFwuj/OdQAXhfdNWOwheL4nmJF8A== 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=8FLXAzlfRnqpSb8fynFNIq1DO0PT3dOLJt7TFCsMd98=; b=Wg+Y9Bf51sV9iNaaNOLbfFj3dI7ZAU3y1Czq0LMRBa7cGAShnkfNN73Thn6MnVU0jvQH/P/HYPX2MUwVa8PZ/Q2wmdI68mzGJtRmRbaSw9oaJCTVjvSxtFqL4FXNOqkTWnDfvJMs+4dBlvjGDS7FEkthfcycQBS8sEpfiXOKesx1gsk7YRGHfmMldmzsPUuMgLWFo0zbxd9KlERq56lmUNhgJIxjYmboZZhxJuDfE4btxZ0NAxQ1GaJDZ8ugb0cbKh5jarPm/i+wYC7yJqC34J921jRDpIpaslhT7qv4ajpJqx2RVGrTbWDI87BnGdnCW+LYcX2EU3solKkazBaxnQ== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::50) by DB8EUR05HT019.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::421) 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:DCE6776CDF91D3FE655F795DBB61E54D454582DA1327987086245EDC25C29AE1; UpperCasedChecksum:56BE1D160B4F5C63E8E982E0DCC5E11E296156D7AD538316D4074586D72110AD; SizeAsReceived:7773; 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:38 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [jZhu+GGCkFwORmg/3RC5358kViOx5lcL] 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-48-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:28 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 4369359c-cda1-4a06-0efc-08d930561e4e X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n5rcr7rK2HtEtCIcTMUTMMsNqLtyl5yw2+m/BER2fjzBwX37xRjs/ED7NnTXC+MY7BKL6GZpfxnmzDp4B99WszGBCDcL2uLPu1ir0tz1F0ecG35IBAOfAKNeFWXK18BkQDpKy7UsRXZHqBOcoLbGcV47ZrDsd10drTqys+eTjCRmpphCriipmBsXvTrpkYeJOJLKAF7lY2+L9CPibouiFtgJeMd15qPj3zMPbzPcL2jnXrTU1caxmXD9iLLImAZk4K3qvejJfgDyyZnM7MVz/sYpD54YFw4giiK6I64MB9JsQMc9FOr1G/yYPZ4UyLrrISB7//oYZ2thSVp1kjchDUsge1c7FZQgstUJbd/8UIbrziCpKw4tJ66pftCABvf92FY35ciPkI2zC6qXPL4VyrTh6MQohMeqn9ySMdXpN/tQUqpl7gSE4toNaxHYpvMxLdRAv/iCCNUv0lGLaHQXQ6zdtu9ntxAL5SHReilgCwVIHVKfTkA1aGACwKUgo/NxgCNUo3DDBN2hhmUZbrQk+K459MKg3AzfDBwnk3Nox+x5nFB38q/8/a2bvRgiguMd9nxHfKXFMe93YmeghseCS9KgGauoF9WzsnGp86jIsceiHnmbug2XeITmWbsZ2rWV7JWZP5S9vz16o5ATzGOTs0HjdYXlOP8PLPJKn60qQfkmnsWZGRxsFpUWKRJOQ7eoBySZgQTvVA0+k3jAWG27AoQQjHskO1FFpc= X-MS-TrafficTypeDiagnostic: DB8EUR05HT019: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y2W4xCg3SfeBS5BPF3AjEhK4dIcYWmCXFUaCGa0RPaJ1TdFHvtXpfc5Qp3wasaKu3N/frnII8YiOSVZDdCjYWP3bxjiFLCeM1+/lzhTo2wHLhTqRxw8DrnMqPffKYcKkhD4cIySx8FJ64QEExGT6LM7tzduGnUQMSP2ACUy1y3sjst88e//pano1e13kV1ZnDApO8wEh9Y9V/AYC3ZrjNwqTmuCsp2xLNCgvIPpBoYBHIudR9LXOcsfB1H/wWF7WfvETy9R6dUz6wcqcaA6xVB1YxTqXTWeCApWnygkVYMpk0sQG7Bw+4ckcKWCqum4J8h7Ufg/RTmRrNjvrxOSSqWZPa3Q8hGceBDnHlKHh/fpV8n1SePf5MHcmAfVYU0oIVZHeGxabUcR+GNExQQV9BA== X-MS-Exchange-AntiSpam-MessageData: W0Co3UJ31RtyMGeKmUSl8BtVYR6SveB8fBW7AyCE9j2M3oYWoBIgkLSjEjD5ewJ6PHFGYAqT26X1eSJ6SphPMwsvnrokTlpnF9khEqCIB2Cwll3UJohBXeqIgYU53oBw/2N8ZG2C1Jvkyo5xIzCdGQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4369359c-cda1-4a06-0efc-08d930561e4e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:28.6427 (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: DB8EUR05HT019 Subject: [FFmpeg-devel] [PATCH 49/54] avformat/vapoursynth: 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: G4V4tdFGOO3k by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/vapoursynth.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/vapoursynth.c b/libavformat/vapoursynth.c index 4ec4e77b59..1578a6ac77 100644 --- a/libavformat/vapoursynth.c +++ b/libavformat/vapoursynth.c @@ -294,8 +294,6 @@ static av_cold int read_header_vs(AVFormatContext *s) done: av_free(buf); - if (err < 0) - read_close_vs(s); return err; } @@ -487,6 +485,7 @@ const AVInputFormat ff_vapoursynth_demuxer = { .name = "vapoursynth", .long_name = NULL_IF_CONFIG_SMALL("VapourSynth demuxer"), .priv_data_size = sizeof(VSContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = probe_vs, .read_header = read_header_vs, .read_packet = read_packet_vs, From patchwork Tue Jun 15 23:32:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28353 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4314761iol; Tue, 15 Jun 2021 16:40:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxB/FvdQMcnaE1tzgx00+tX5YA8tl7vyuLJgzb1iXox3QQHwZhkmQZXgkUMHSNhDdTgW0Ie X-Received: by 2002:a17:906:8056:: with SMTP id x22mr2044074ejw.298.1623800433794; Tue, 15 Jun 2021 16:40:33 -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 a7si273210edy.476.2021.06.15.16.40.33; Tue, 15 Jun 2021 16:40:33 -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=FODnR4OW; 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 8EAA168A148; Wed, 16 Jun 2021 02:34:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2106.outbound.protection.outlook.com [40.92.90.106]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EC6F568A05D for ; Wed, 16 Jun 2021 02:34:40 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ixauRdboQjzyr+aOfCunios9KRVd/UfDSka0SO3/CYnvY6OGeo1caGmnN1L3woplKXX/nrfLaKECFdRzvOQ5Qsf8MFRZdr3h28UihTPZ0iJ2jSaTpsTWUjVBY3ofajCDyztt0l6BFjNXmDEeBbyTpwq8GthwRHeQxm7/G/eB1MfiaoAzXkPfBi7waJQnFi2W1ARtcF+Pnkg4EMrkHGdZR1atddWWOnL3lrjsDDmJJSRcg2O6O+V1WYrCzrYmNPD3+n39TDrKZ9/Fe4Mzjz4fjG17PS76Z7E/qo3YBxoRf85mWPOdlZQOokaDSDQg630amdmYfOjcQ+/uUlYRxewBmQ== 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=fpu3a4LxJvFSZ7LnsAP8mDL7t8e/gmNjOqbi5SD6Pss=; b=DRtQ8ETZXnyIw/dr1mo9bhlLXhaFM5q9o2JGE/1N+mu1szQreAb8yL91r6E0vn7ywklI08JC6BMADsb0Xox2DLe0k8IKOMpkED7o2Yclo2MNWWyye7rybwHaHYkCH/XtgmjFnL78qasi0Cge2lE9487OfhbADl/PyNO9vfAJn7zalC+U76QEHYfkwTWm6RoUDeLUHAlqnKdcpiht/AN5sek/C8nf6HQ7tfyjvRtUlC9aAUQ6JsGn1RcF/AUnsex//kChziXvJ0XetOHI3wUexmIUJgCib/4casBO014nch3r/EQitm/T6xvJklbI7zIKgl3o6Dc60hBmPs4xi3R7Zg== 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=fpu3a4LxJvFSZ7LnsAP8mDL7t8e/gmNjOqbi5SD6Pss=; b=FODnR4OWbckZ/vo25C4HtDRpx2SuDLLnHVZLZVuTS+jdMjcBfTNNbZFV5tRLcsUqKJnVfMk0tJkjllhUb8Ef/FWKgfPHslZrYNFJ3aC0z/4MQb6B89FDHm35L1rgIXuBvIMoCFx9+VUsTMiiIhGSPtISWUDa2pRjSBiT/tRaJ6CO8aIhI8pzJOAJ+ELoDBj7Z7PvEUjwaDjINQ48cvxNxh1C8f70ldMZbRPPoDQRWxXlccUcA2EGNoyIU9/D1qwbZxoz7xak3hSJfeQ8xqmdsN0esfVzurmo7fQ9Gfb7x0KSps9R+N/ndHuYSXtbkRx+Blnmh1YjrYfeLrxRXOCcLw== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4c) by DB8EUR05HT116.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::185) 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:3E2E2C88DBF5BFB16C87FBF06E2D1AC37B70BCCFE0B22EEB99102C4DA9E096B4; UpperCasedChecksum:F25FED56E955FBF944137E6EBDE8C2FB4DFB7D0C25E51A20659EC74ECB089049; 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:39 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:39 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [XEJJX6mqSLjXNTcJNR73HDo41lm9/KOo] 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-49-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:29 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 206211f8-af34-455f-8186-08d930561f09 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n5rcr7rK2HtEi6ZBerjIlOInM/x0oiX6avqH2vGm/+WmM86/OYOSB6NQn31VY5/4dpe3+Jyz7DWcz7oEME4YW4ZxX244Aao86P5bF8r/r6D/mksljtXZibpku1Q+B857fMRoTq0cLH6n9lmT9aOP07E/BcISrjy8Xd3uNItF2KeflX5wpuEoUebQQBxQGY6hndbybLRIRbhB4vYhaBzcCMVKtkxwWLorPQXJSJRrBsUx+6kxmyLLOmhU2kCv+GXaie+AIGrzSrc8Djaq+7LSaXLdncWGIVNXf8dvUgwZmBDRxPD6onsWDvSzFtlkpTR4UyzfYR2cHuVGy00tRDHjmUHGHdVaRgG5wu+t9aqQ4wHbxBH99twM7LPMfz+0CcowazMj81AwJp6vjbtMo6vjjnGYjrPQPbkFGfvG+ROn2qurqZKBoKEWj4PudBQHbuFNrtMeA7lukTDOhWFIzpr14L5UYZoPIydtIlUSJovBcz13h4FoEUIYJufTTYgxvwGN41+TZhJ2HGZAshWGOhhqTk91KtBjrVbZpR8dAbjSq8AxIX/8A6Ph4TnV1UzbKnrIjUdu27eCXoIyNA+XT/3kz8lsSejVaH/amHo98qNz0cQcMpRy8VtkcUGEtnBZ/VMv9OCCakFIsk89m50pT7ADhTwpA7PSdWrc1z6uDKmiplIL2OUdFNkmtNX8FTnCjVdeo9Azowf0U/c/IuVdDAf1mfAyrAs1IDXm5o= X-MS-TrafficTypeDiagnostic: DB8EUR05HT116: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tEqL8Hziu9b4C5/qcOf2mJGNnJJhkRlVjcuZ0U2LRZHRh66ZdPNfsY0l3Jiq78F2ODu/ZjCOShpvsO9EkLuSmvXAcCWrLqwI7mDaP6oAoX5ZYrBzcs37NDv7+WteEgpFi89HosVf0hRo6T0MTmtLBkE3NXxcxgVR10eU+6FZaCRsOZfu2nnAOHAtDj/H57uRCz/lHeByl8y25oMmLXojAizXgT2X/otGcoXsLurNJ5F4BVqqXXNIgg6O7K5jJzLuVB2hzMI5bDBxI9yB2t9bXMDChk5SHE44s1mVrbXr3oLoW0oA+akgKDJFX3MIklxeiKMTnR3DF9uFVMXjb/7p16LA1+O2c1X0Tlf2UlKsmuUy9QejnYZqozWNM1zAgEdEGdi02pOpWjR+lsQFmbKzNg== X-MS-Exchange-AntiSpam-MessageData: Z6A/q9jJ6a6rWz8ex4F0XPBKJh8BPLN1xbJ2EIuz0HtKrdkTlfmPcuCu7n8ye44yMAhXRbb9d+PC9g/u88XDt6FL4avkAmqDQuPEU5aDbSsKjUJd+TLXhMMQzH0AZo0PGIQOp7DRPb6MiPq6B0wpww== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 206211f8-af34-455f-8186-08d930561f09 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:29.8811 (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: DB8EUR05HT116 Subject: [FFmpeg-devel] [PATCH 50/54] avformat/vividas: 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: s+sB4m5zs5vM by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/vividas.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/vividas.c b/libavformat/vividas.c index a7deab0e51..8d1c1dab29 100644 --- a/libavformat/vividas.c +++ b/libavformat/vividas.c @@ -613,7 +613,7 @@ static int viv_read_header(AVFormatContext *s) ret = track_index(viv, s, buf, v); av_free(buf); if (ret < 0) - goto fail; + return ret; viv->sb_offset = avio_tell(pb); if (viv->n_sb_blocks > 0) { @@ -624,9 +624,6 @@ static int viv_read_header(AVFormatContext *s) } return 0; -fail: - av_freep(&viv->sb_blocks); - return ret; } static int viv_read_packet(AVFormatContext *s, @@ -785,6 +782,7 @@ const AVInputFormat ff_vividas_demuxer = { .name = "vividas", .long_name = NULL_IF_CONFIG_SMALL("Vividas VIV"), .priv_data_size = sizeof(VividasDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = viv_probe, .read_header = viv_read_header, .read_packet = viv_read_packet, From patchwork Tue Jun 15 23:32:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28350 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4314883iol; Tue, 15 Jun 2021 16:40:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw30jzLvHr7JQe7/wXQ7npNPOxo8WPurU35UyQEKZnkZYfHV9dmCXOSirYtWfQLDpyHYi2o X-Received: by 2002:a05:6402:40cc:: with SMTP id z12mr714757edb.202.1623800443551; Tue, 15 Jun 2021 16:40:43 -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 cq9si277147edb.321.2021.06.15.16.40.43; Tue, 15 Jun 2021 16:40:43 -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=CZ0ry2IZ; 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 769DF68A16A; Wed, 16 Jun 2021 02:34:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2105.outbound.protection.outlook.com [40.92.90.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 31283689FE2 for ; Wed, 16 Jun 2021 02:34:41 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U1Cl8dFgxKaJ5uDQfwLDMteFRqpL6IxSot0/wt4CgbdnRP709SYE5DTSee2cYlu4b70ZNe+qEcurhPVf5pm5LZTFfqiwbEvZKCKLxYF6GhFUmwliSifDT4l3towYwrV01g4L/wRmgR3MmAAkqp/CyUlmrCe6q/RXzp/ceVf5OeVwIz2FemsWvmrVG6ld3G7b4J57jyAjD5sk96A1oo0VhRNcMrEqOG0/fANTqJJU3QvFnzH+U9z/keNbEeWjkfsTXCFTKVcbyS6biswqCbC2J7YnbpgscOaoSmrPAE/IIovx2CCcFk9NpAOaJV9NevD0qfNN/fjqTBD2Md3BS9eC9g== 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=QumfqLwM14d9VFZKeFPXiy5QAhisxsyBUkkXZPNd12k=; b=Wdt5I+KmuWUsUqI3/tywdSnd2JGMBE4Q6yNn/llZ8lhhbRxUD12ChqZvptkJKPWkxfhWvp30SryiRlDxgFR5KcaoRC5DwX9vFAI/dwM7YIUN3qMK76s1dWLjrHgxPD9iv3BmBuBcze6pOrfarY3LyV0Z3qhZIuciglBrf3MwOambg35+ayday/233trgg6d6YtR0nyFNThyhEt8uA7bM1MNA77NCG77Ah+jtq97GIWXmObEQmEi3VwONvXLjSnk8yeCLoVb5Oyrle8wGKjTX++8iPhNJHDMtKNQHtFnNhIj0lgN0Vn2akdEuY1ixSLZZNpYd1OzETcWK5IC6K5JIYg== 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=QumfqLwM14d9VFZKeFPXiy5QAhisxsyBUkkXZPNd12k=; b=CZ0ry2IZ5V/K2DFbJ3L+2WKsahT90zFo0T7N+ISFDfrg3Lmkl27KqDMY5IswsaLe+t5rSRFeeFeuTpERYAZsG/klShQ5LV31yxDTErgrxE2wNddcGilHT5qNOawkOgQfWj09qEAiynBrqUjsPgEqLMl/HkNPAagXPr2mlpEz0I8lJWA9wFPiPlmqAiZ/ElpyQdeqFVmONQJaD6fjsXc7koKwrjwugqWol2hZxr22REz55ntgTD5rvKgYiANjkpLB/Lp0wsNxiQT9lDJ+RfXzVzJq+e8QdLE5vvr7PpkMPTG/TPhIkydpysZtVwg6A+Ks944ZkPpPdnoqdM2fxVgIxA== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::40) by DB8EUR05HT210.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::437) 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:40 +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:40 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:D81B900FCBB7EB78D9ACEB343C6389D792C3E257B398DDBB2F63EAD3614A747A; UpperCasedChecksum:299943CA92BFF0BAE7EBCA9A4A73EF10A9184FE39AF59A720BCE4CB71BFD185A; SizeAsReceived:7772; 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:40 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:40 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [HAdgWo4biMvl+KgYvQ2d4E28Io5CdbaN] 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-50-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:30 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: d4dc6c69-7300-4a86-effe-08d930561fbd X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n4p9PDP/HNk3ln2w0Uxj9nx+fAXJuGNw5Iy65FUPojR+i1HmmkkQq2tGO1mSPuKKQGkH6W2OrWyQwX0HFlapQ6yjxgaYEf7XJwshpGgaUrc5FtpcRMEDShpmPv8mZc3Ul313Gjk+tZ5pK7GmBt3w5MoZGOCMnDRJiJHQOf7OZx1pnTGevxqjQ7XR/LEJlIpvRU9L0J9ZN0R5q2mePaJCT8d2M931LQB3s7RtJdDL6cVFe5Jbhzf+fYuP8RbxSQiOpDOXzwMtRzBoV/wTDaFxy7gvUPppnpWcSLwhdLUqvZW5K/PINMZfmakh8Xbgxb/T38dVuDzxuejkFwTYHcCX4ykkOoCjl52M0kXdHco4MttFfKRbjuQucOUCcWTtfD4Wt2ZQ84O3e9wMaaiFOflfmou4c5AU9ZzCekkpLj12Oz4I3lLOSQEWEjME3wOBEoF6XeoajRCJN92ayWinvlOkEvCFcL/3jQ+ayIslHCW//jrN2rWD4gieiuFLyqfBECuO21BCJMnzZjCIhZcKaxy98YPqbN6lktC0Qar1sK+NjbRxUlI5nB8HR9SD2m1qtgsXXnBQ2AcuLnZCuWcG/1nDRdOVj577IawMAnwGV3F50+1vSw/U4DHhYOMiYR86PFOCWyidgaapKz5LF4FEKACCNNhNds6qcm0NEiO8FYtrDDDkvhNiyWEaS7q7OY0tqzL3xwAELOsej/h6yPWxeMenbj9sv9x6grB/f4= X-MS-TrafficTypeDiagnostic: DB8EUR05HT210: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wyxTxFUgrWc1UiV+RySyhWCcA+8m4WUM13gNLLw3TwGkW9m0xRBEw898VX62jUrSpFp3JLXk8zxBTwkA1gAj4FwzLKd9J/xajSiBXTGbawjYFEuhGcZzn1TqcJrZ/1MMH2CS3VmQEUNdhHbCpo3oRyu8HliVPHay2PtI9r90ztyNC+m3y8KnyBQ8k1TkK16IVgCTDajvnrn0WBeNBmV/OzQS3JRKPiQf1occT7tQ5OqQ9BZIiSQHKBeSLS99EvLMWNccOFkW9nPyWWByxXoy44Wm6Otajx0V7PaBzFIPD2rkQpc1tQ29LVuQAS7EySg81qRXUqwv9k8aY9YzN21O0mt6E5tnT0D4ll403a2biavUO8jRfpFEvRSMJv6jZXKNJOu6/AEzYAnw7AYq1p4Qjg== X-MS-Exchange-AntiSpam-MessageData: HUoWGn5vQEc398gswWkhq6zhRdLzMPM4gDmc0riLywm8XYCyzpuBEQpQqkr5yKPYBuK72TgtMIfT/zVSl+gDSq5rzb0i5nqR8AiSKCuOtBxozb0+yFYQVqaRtbwbLveZR/42moe5gxYUgjQ+5pr84w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d4dc6c69-7300-4a86-effe-08d930561fbd X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:31.0286 (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: DB8EUR05HT210 Subject: [FFmpeg-devel] [PATCH 51/54] avformat/vplayerdec: 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: sDyb4cQhXVRf by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/vplayerdec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/vplayerdec.c b/libavformat/vplayerdec.c index f6c2b35ea7..8c9ff81163 100644 --- a/libavformat/vplayerdec.c +++ b/libavformat/vplayerdec.c @@ -83,10 +83,8 @@ static int vplayer_read_header(AVFormatContext *s) AVPacket *sub; sub = ff_subtitles_queue_insert(&vplayer->q, p, strlen(p), 0); - if (!sub) { - ff_subtitles_queue_clean(&vplayer->q); + if (!sub) return AVERROR(ENOMEM); - } sub->pos = pos; sub->pts = pts_start; sub->duration = -1; @@ -122,6 +120,7 @@ const AVInputFormat ff_vplayer_demuxer = { .name = "vplayer", .long_name = NULL_IF_CONFIG_SMALL("VPlayer subtitles"), .priv_data_size = sizeof(VPlayerContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = vplayer_probe, .read_header = vplayer_read_header, .read_packet = vplayer_read_packet, From patchwork Tue Jun 15 23:32:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28356 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4315003iol; Tue, 15 Jun 2021 16:40:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxr3qtFwfGz/9CZqVo3UmaShAZ1o6Ohoa3bDXsMelw9iC5K+1eRe5btLaleItBccdMIbhrp X-Received: by 2002:a17:906:8688:: with SMTP id g8mr2030412ejx.470.1623800452831; Tue, 15 Jun 2021 16:40:52 -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 z21si322354edd.20.2021.06.15.16.40.52; Tue, 15 Jun 2021 16:40:52 -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="TBqp/r0X"; 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 7E65568A17B; Wed, 16 Jun 2021 02:34:53 +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-am6eur05olkn2050.outbound.protection.outlook.com [40.92.91.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7894C689FE2 for ; Wed, 16 Jun 2021 02:34:41 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F5gWUvHQ1o9401gL8jI2V5mYJiIGbfldzoTbkdHQj1JTM1VRBCJQBodbG318sQudXggyvG9gnA+RPWiB/z/Vw0JnT3rTj8A1HnHSG+YXOyXamVx3jsDGE0fdMzSSc0tDNsq6W0iA3lr2QQ0Do8ygnslEdbg/PxIfeT6kq11J81/MonQVFPAy3dcRkNIPENFD32YdjHKOD7sD7ifA88jt6KHVbil3Bv4loYMVC1iX2NLAm+ZcF1t4gtmOclOmriXDBod8De8C6puv9EJs5MFA+8KlSz92vmuREbZ1GVCiC+csZdNaExkWIiccF6LSaDmBsRpEDphUiowO1tgBR8QGFg== 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=6T23sqBcCjaTrcXGAt9AkGaWhEG3UxEXajW512HLQY8=; b=dHTOr9E5yIG7ipsh0UJQ1AzyIKW9yqqz4gtVkFRJY0kDuCKoxxkHu3toeCugdCEIRB5Y7i9hl+TKRI3RlB1sIUG8erxuypSlpWZdDgZAfVCtK00tCwpmUUTRN+bPQdhR44Dfp9qKRz0E8Sk0sDF99yW9qDOdIh2CjSIMl2bwS4VLP0/liHqqYFFYtVxEksOiHx4y3CelbkYSRLJVsKK5MjvuvHmyk64oWv5KRSN0la7Lp/JQrvjSu2QSS4Zi061XaGIm3w0cYTy5n2sd+GNoLXVKKWYaEREkutcXxT55iQ5A8iMdKaSkePh3hKeYfULuLHxjSuBX4W2HHHmNPxcTBw== 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=6T23sqBcCjaTrcXGAt9AkGaWhEG3UxEXajW512HLQY8=; b=TBqp/r0XEg4GgLS87+bxHZH7DNCvdVmkb57I7FPxZGei9PdmBcKcfRtwN6IDLP7Tah3mlg7LGOTF/4uWJyiP6Znjh5cepuelgOKspwC2YnO2P0mww5vrqEsDWduJkK0TzVwLrek8+BUGhLyOr+vQ9UMZD9ic91mx4Kfaw/CVQt41ofrgSDDG4szuKPgh2JmkWoxaThUK9A7gWOFKIe3RvSZMZbeEYSi0WiRs+ZER+R782bf5eCzrmanKZAdZf7Xb9v195n9s+Acs3YEfPnQ2qAVaMHDIB4H8s3MUyFsHgR0SWfbvibZnNin1Hb21q9jQASXpTlnp3hV9UNPmqQAc5A== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4c) by DB8EUR05HT034.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::163) 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:40 +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:40 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:4E8F27327A2162994285E8A61FE6AF21CABAE7BA9667D36A6C05996F34D0A092; UpperCasedChecksum:07746BCF2C511A92FA83AC8DBB3A8459D410FD6F89EF072DD053788EA7EB83CE; SizeAsReceived:7770; 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:40 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:41 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [1MZMuOTWCREaoUsWJ0XjBKVEnKvVXAUD] 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-51-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:31 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: a31b7a8c-26c0-421a-e956-08d930562071 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4p0OETr0+Jrn2aW1jxIgMYUaObSqmwskCosDNop5Tk9ulp1lMTaYQPkGrd7eTU5eLbRcsU+oi20U7e4DavPIFhjQE3b1YkHIrA7gpc27fuju8YxYHuOpOp9EKFrUYw0BCjywNDly8mZlCrVgvn4PrhQ+fg6q2R4nICVowF4baZIPz4oteQXkGLlBWkoFPVpDpFzkgVaZHO1xM0rLI6aEi9oPAanzxel8JtG+/A2+cHOp228Ex0UHLnqKi+2YnoriqnipleJBUTOr3mOnbkwPEazdivUUnMSmt5AEkLRyo0kcVKnvDU27C6//xy/hKUJGt+z8QkKcj28a196ZKYU1jFowTB/gW/BPtkGcnSYOv1fwyEMA+spVmxs000T0tvqzkBLMrqJDSBZsZj0h8ZcJqUiMXi259GqbvnwtCGyBaaNeSQNUviJfijY0NWFTr3Jy7IbnW+pKhAPnnSPK/szYHQdeM1HfUENAyhmxQLwHn2Ba5qfdTYFOTo1bW1nNAI39LqTa5+utg+CCk4IuaEHWiP3b4AWlbpQQp4FkDHj2l5PtIxWDEzjb5xqF1F8ZNAucXZ3Flrf35RiDr+ppYEv/3N+25SPm0vzzPmmnjjTRctl1JYW7CWb86V85tZiLA53KTuNDDZWjDET2qgiVyw+zpP8r5Rw41CgpcqYrxPrDbOKiFGnTE19s3nApiAd0H2NR822r30cmNFnqNjVPEp3v8g9bdGBoJjD8jzx6jAAh474Zg= X-MS-TrafficTypeDiagnostic: DB8EUR05HT034: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ClA08Rv4+Dh3YBsIxnHxcSiCX0JqyP9GlRydU+zJ/7xbVooe0qZp9D2koFVjqPLJCoCGQtfs0Db4Jh8h83ATX8c9dMWXwpAbk9u/Lgd8M1CToy0r6b7e0RJbS/5ZLx1tZ9j0o7Izch26Qv4fPK+ZQHC+ss5U9oCCMevPNBxlliUyQuo4YVIONd+hB8H59bMichlaA3aEv8hWFd1g6OHKf08HIybnKjj30CEc39bek2pRtDNkuyd899CPqb0WqrNOwg6FpDshGe7YznS9IuV3Y7x2V/Q02O30SJo2ze6IitIrzbMPglU/9W1zKCrRfLdvcaRgDdw9t3vRtrG+SpI1JSMRAI9ULjBFH8K5iC3XEYdz3clb5GVvF5ulMPUzu7gqVTfJCgNOx0ajXv/aT4aZaQ== X-MS-Exchange-AntiSpam-MessageData: /dZKkzkRxH2/8GzBrXbLz7T1fpgysewJmU1qVrJy6ALHlN3JKgUTSoUlxkQl/BuP8oKqe7Okis9glq6d1/ywRvsRKuVHdxzmTJywOpLIkYswxjcBD1ycHUaZ3GWdg4b6+C92fZ2SxIu56GKZt3t/1A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a31b7a8c-26c0-421a-e956-08d930562071 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:32.1561 (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: DB8EUR05HT034 Subject: [FFmpeg-devel] [PATCH 52/54] avformat/wc3movie: 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: Mr8RCNoIPksO by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/wc3movie.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index dfb2462072..fe2d0d4245 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -139,14 +139,10 @@ static int wc3_read_header(AVFormatContext *s) /* load up the name */ buffer = av_malloc(size+1); if (!buffer) - if (!buffer) { - ret = AVERROR(ENOMEM); - goto fail; - } + return AVERROR(ENOMEM); if ((ret = avio_read(pb, buffer, size)) != size) { av_freep(&buffer); - ret = AVERROR(EIO); - goto fail; + return AVERROR(EIO); } buffer[size] = 0; av_dict_set(&s->metadata, "title", buffer, @@ -168,26 +164,21 @@ static int wc3_read_header(AVFormatContext *s) default: av_log(s, AV_LOG_ERROR, "unrecognized WC3 chunk: %s\n", av_fourcc2str(fourcc_tag)); - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } fourcc_tag = avio_rl32(pb); /* chunk sizes are 16-bit aligned */ size = (avio_rb32(pb) + 1) & (~1); - if (avio_feof(pb)) { - ret = AVERROR(EIO); - goto fail; - } + if (avio_feof(pb)) + return AVERROR(EIO); } while (fourcc_tag != BRCH_TAG); /* initialize the decoder streams */ st = avformat_new_stream(s, NULL); - if (!st) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!st) + return AVERROR(ENOMEM); avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS); wc3->video_stream_index = st->index; st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; @@ -197,10 +188,8 @@ static int wc3_read_header(AVFormatContext *s) st->codecpar->height = wc3->height; st = avformat_new_stream(s, NULL); - if (!st) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!st) + return AVERROR(ENOMEM); avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS); wc3->audio_stream_index = st->index; st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; @@ -215,9 +204,6 @@ static int wc3_read_header(AVFormatContext *s) st->codecpar->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS; return 0; -fail: - wc3_read_close(s); - return ret; } static int wc3_read_packet(AVFormatContext *s, @@ -313,6 +299,7 @@ const AVInputFormat ff_wc3_demuxer = { .name = "wc3movie", .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III movie"), .priv_data_size = sizeof(Wc3DemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = wc3_probe, .read_header = wc3_read_header, .read_packet = wc3_read_packet, From patchwork Tue Jun 15 23:32:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28355 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4315089iol; Tue, 15 Jun 2021 16:41:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0zj7tpHw1syFBrtG814nQUYSt2uXSqGTt+bjvOm+kM1rmL5J6/CQgfrXVujL9Y6pSHzf9 X-Received: by 2002:aa7:cf0d:: with SMTP id a13mr708971edy.384.1623800461047; Tue, 15 Jun 2021 16:41:01 -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 e16si299376edy.219.2021.06.15.16.41.00; Tue, 15 Jun 2021 16:41:01 -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=F6TlVYs+; 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 68B7168A1AB; Wed, 16 Jun 2021 02:34:54 +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-am6eur05olkn2024.outbound.protection.outlook.com [40.92.91.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CE43E689810 for ; Wed, 16 Jun 2021 02:34:41 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ieVGR62WnmCSQEBkh49KHwGutyV8OXb5dWz7THhMgEJZFTUDfCATiS6crkmpIJIfudKsFz9uAX+YJcqdQr8OQntm6fz6xMWT9vGyxiUYiF80Rz39lqaUPjyekfBDR0fNfkBeNeJXsogfkuDcqaEQYRzAu6JTAs7moOwk1V9kJH51Z7YYHVO1qSJhdgvhr1LoFbO12MXgs5HgCYS9AmeBSe6lSJTCp6fS+8RutdfRjvOEEkbxKuJecZTl8BWG5LCERlrOfGpFE1EsPpstW+zdlb40gSe5vtBpjits1Fv2EOJPLPgQGy584PDOOkx9c7eRl+Sp8L4OlsbmEBdYJIOfuw== 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=6BGNETBjJfaNTpMtEpg0Q5eQl/By2y8IJy8IJpId7dI=; b=FwOGzpAzQVH4wrhz/YGe9CaScxBKYVv0lVJt7yltikzJx7o0LSHqKzmTLnkTBTCG8LLIYpv+AcZlSzw4sbJl4lvNAt/bevZqY7jB6FvnE9wAN3UpF+3sWc7Ib8x6DhBQnweu+hUf81dU+JqGo27QwG0J0kMgEhbV6qPxjRbEoCf0Q3nb1LRjo3Lot/ID536G3IRdZgRixUe1FdqQX84G0ZyC7UB9oyRf1brtWfxfdYs5dmHA8G55RzbHaKwaSKc6RNPnWf9afnPqI8qgk5J+8bvmMH44Ehd8pQJMps2RRUjlWDBgopEf+sAeHEx6CxAtz3Szr4bFd4kiPWQ0/Yi+hg== 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=6BGNETBjJfaNTpMtEpg0Q5eQl/By2y8IJy8IJpId7dI=; b=F6TlVYs+wpj4iFrHEmEvN2CQm425VTlGqCqm6hTAGwyRc+8kYk4hSBqdZZX28O+hoRXe/ZavRmpIDROhWKlJaFxyJNxSTG17yHmhp2y93k9E1ud/HqGtAwYUainLLBpPhjMOTghxaMEjRGO3DlLs36OEsNZ24j2NSqNZ07Db2uIgI3yU7QmkkBX1QcWbNP8tfWFvWNNZ14FoKarGEGzcMz+IVApwFXh/dTOxSiB99Tpa+5z9cfAE7Zo6u8HQ1W/a60B9hVrce4T2KNq94MNTT73vd1zAqzXEuVimPBj+vETt/GRWKgyYWhtshsoVH8kUXn1oX1ZhuvRgEMPUZpSxBw== 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:41 +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:41 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:38C9D27B7948784C1CFB57DABAADC792C25C350709528BFCA2C9A9510DB5794F; UpperCasedChecksum:DC89729C6ECB6C80E38230A8DFCCA9F237D2101CED9BA4D79EE9FF541B532A6B; SizeAsReceived:7761; 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:41 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:42 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [pyddE/8DIzJFXys3wT4OLl9O6XZorbZA] 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-52-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:32 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f11338de-c213-4a0b-ae16-08d930562134 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pptWyrQdC/n7ChXvHkTLkizeyqHo+PrbhYdt5/fpTHbSA93BBpItFB8RY3aa56BZ5zSiAeXM9Y1IRe/EzNtbPR5AFrleKGzdp163OsBc9WL+obodUmsFrzg2sRGR76MkIqAXIhbIezhmNeuxKgkqs+GXGUjxzClSNELV8oZiVxVLtiwEsb7vACEFT7DiNRSWjfmPE8t/wzhWPtqhwxDc7/lRSHdcLEgHDk1DdYcjiybr+nDp15tijWSbSaJdtUGJ5aUzkroxGCov7ADV5c/ud8mwtZzFOi8WFg/fef4wmFNU5aOe7rwgcvG+yDC4zk7TZBrU7VMIe0CtQkOvZgj3Uvu1W9WZ2NhHJZi8zTR33BAY3/0cSBtkP5Uv2iJLL2PZdkMIy7YzCBKGYpsygrQCRHi2VlgKo96aLXiusO12oN1pHWQriSle2s/mhjfEe50WgwUdy7Z8fgpLyKb9Itd9LSBQhL3bZ8EOQ9+pmVny7RIrhmtcKULFmNc0joBGhjdoJLo0CHYkYk/PzUoJn7974yhdfWGjrN9/Y9F2UsSne7am0rdx241GNUy8wO3paxOmQjfo+MHYZgb/apNeTIDlhd2JW9pFHNId3S44CElIKPtJeoeW9Rj+3RIEgfB/n6UapHFwk42udQogVK4hjRmxqIb+cxsuAdXqCJC6VCoA5f8xrrR4V8a3E2Oa9DKhXg4UG241x1N6NJeGLkVDFe6g6MMMnBTTvr1hsteJ3ITfeQmo= X-MS-TrafficTypeDiagnostic: DB8EUR05HT068: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LFn/5BEcrAWG3hR2JnIUPQeqVNMmWvI6GNMOABrlamDNBfEvtjYzEqNf5Li4zn6tRtCvaCxL2AaiqM7l7/b0qHmPuSq79MAvJbcilmcYkY1jllMPWT4kXOyJw06XtwFmqA9ifuYrDVqL4DK+LeW7gb6+8Hqr08mOKibMnzqs9f6ZdhzYTPbG93khpWX18Dh92wIOrS/VClKEa36SNcjrkjpTkatvXPPPPWF9M5vEwULYCRgPE1SbYdULLkNaCRmbNY/OFXgvdBLEMZ351f+vwm6aYU/sSaUoVbkSKwooOcoqFcaP1+D63gV9FuVGNu45URJQTHODlsh+HGomzZ4X5oFxO8IStruT2ZyQI2eM3CtL4Vpo1kiAjcWOfhtfZKe//LAkauwsg45nfgFS+hYtYQ== X-MS-Exchange-AntiSpam-MessageData: sa8InZ//DFoVS+a9uY96BKzn8buQku6QJPTq2bl/w/vCdMYwR55KsNdbsmFv00t2nn4zzPaZiHRjRDNJmAqYkWEREuJIbs6K7H8X6Kuyf4NdhbQv/PyTUQe0n6yLTL3oGQa9NI3wXZOtTYvSEuBXAQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f11338de-c213-4a0b-ae16-08d930562134 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:33.4915 (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 53/54] avformat/webvttdec: 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: BmR+CkABQQnU by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/webvttdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c index a4654034ac..52320ba7d1 100644 --- a/libavformat/webvttdec.c +++ b/libavformat/webvttdec.c @@ -164,8 +164,6 @@ static int webvtt_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &webvtt->q); end: - if (res < 0) - ff_subtitles_queue_clean(&webvtt->q); av_bprint_finalize(&cue, NULL); return res; } @@ -214,6 +212,7 @@ const AVInputFormat ff_webvtt_demuxer = { .name = "webvtt", .long_name = NULL_IF_CONFIG_SMALL("WebVTT subtitle"), .priv_data_size = sizeof(WebVTTContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = webvtt_probe, .read_header = webvtt_read_header, .read_packet = webvtt_read_packet, From patchwork Tue Jun 15 23:32:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28357 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4315178iol; Tue, 15 Jun 2021 16:41:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOL0JclKBVcy7MtOmWbZ99wC4j1f0k09/HyORh0lS+7l1aJ5lq5ShHoLkvl26T7J1PYGf+ X-Received: by 2002:a05:6402:1911:: with SMTP id e17mr753718edz.62.1623800469682; Tue, 15 Jun 2021 16:41:09 -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 f21si417268ejl.315.2021.06.15.16.41.09; Tue, 15 Jun 2021 16:41:09 -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=rA4+DM2k; 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 539E268A1CC; Wed, 16 Jun 2021 02:34:55 +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-db8eur05olkn2032.outbound.protection.outlook.com [40.92.89.32]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DF6BF6802EA for ; Wed, 16 Jun 2021 02:34:42 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WI+cur549zuNGVk97Y/WnqDEMohE3gqJzjO+0X80+VdkqmjdOF2DMfb/EVOvG+Pih2DCk5Ctm9UY2tD7CyZqVTGVcMdtzh10Vaaf1MUkzT+9J5dQZsJ+EzcM0TD/jTj3x7vGTqYNo7XZ72zUNVGDdhW/dv/jWnZ83MG0hSMLEjPcKuKa0LSRp1VrQTm9yPzv9TbTtiFen3iil2ylgtCObR05OkSFB9M+jOgh3mQdZ9O4dmIAnTE/G87LAxXxStOl7kd2i48QuDQYbGhSxSG7IbsBUBOlmTdzeAkCrUJfj/APYduCJ6cRINqpz0Fjvlk3zn1+9PVaJNkWmtDnadlhGg== 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=Um7izaSMQlNWGtHvBdjUguzXRXL4lawfXyCcmItZy3Q=; b=VK2fl/ydLhHGBsDPFA19Y6BsQStyi4017wmgKSrB/25vIofuqdkjmfSJ5LENlSz2xXQEUmo/zI0cxG2ecNqCMdzYtAJJU8NqVe+8jCCMbgaZ4VFhtbZxeOu6ai8Nc1L7Enj2/VJY4gp5zN/wigzqx5op3TfJw6Xwg+1mps1h955WgdJnkAQg22ejkCv+ZFLZLjXi9UkgYbss8/n1bPHGFLxuszjJqbKReOcLntZn2P6d0PehrF8TUyTFzQSJv3SjTyh6Y38Qvaz5VyslKYR7+C6f+VSEzRJYJ9D143epapp4mGkAWM8BIC775IvptPnVCMYEzB9LwSwmfrtX2JQHXQ== 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=Um7izaSMQlNWGtHvBdjUguzXRXL4lawfXyCcmItZy3Q=; b=rA4+DM2kfxsazKbHY06almVhhUEMtbLvyXhLaJtp9Q8TgTKcofWxfKU8pVYzzvKCcO7dN5bOVERrzEd9fi0ErL1HNlQzfY9nc2cF4v4/ndg+MUnedokYCVUTNXBKEHOx+6jqSoRn02Z3jzxn/H6XNALoR2aFSABsvpneZT9T+q4wy6Ep6BK35XwzyuVLrpTCH75E14fBw/iZDYljyOvolB3elGXlEYZXUMSxFwG1Wr+/T8QEg81ftNydgqI/w9VTEC/jKDmMw9NUZLGiuOUdt7soEfY6H8e+GXsk38xLPALsh3vuNoQkTneMyQjS5JOMHEAJgMC6pFfmnBhYADY0xw== Received: from DB8EUR05FT027.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4c) by DB8EUR05HT113.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::463) 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:41 +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:41 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:821A86C9131D0B77244C83B8418232B1474B50CA390A7F3AD422767C8558C5B6; UpperCasedChecksum:CF1CBFD3441287F2B2E561A2999B29637987689D3299201535705176D73858CD; SizeAsReceived:7755; 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:41 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:43 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [F6QCKmnF3A0w25AIk9XfwHdleCU5xCs6] 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-53-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:34 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 6262e6b9-c9d7-4380-29cf-08d9305621e3 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjCxT4QjM6H/PPytBgYV0nFnK4ce95uX0hbSxS7/y5muNFF/BtCn3QXd6Evl28GQUqGWxNyXrJ0NRHP/+hV0BzSm4lwzz4FURKmuMzTx+wF4bENtOJzaACAY/GJoZpeDw5g2gr6zTlDnI3GxNRD0zW0IvatxgBdxvvx/HbeplLgKAUGF+KStpIMjdaK1kk9Q2Z/+mE2w5mDeaOZfAE/mqbMaHneGyGnIxo/Ht+sPPP9bkLx0qqrxpfg3NEwPdFFBAvOtKzzhAbQYCsRHw26ZhmYxtYt6eoHg/YpxAchkyuUfawCP7P0vKH+qWI+ns/YOgbOdS8srlMQ0DMgtf/CM6N4uynIxXMiSZH6/3bc1uxutMSNm2eatKrWirl9gO9Kfm9OgY1mo4/haEDJhMP+xOXlow1/zssc/rqEeOMweESK+g84mdIhgmqDdfTlLAZHML6oGK0N08GTizhJr1cjIuF+hY2z0IbBue6iwBSvdciVYXkWrDrsSYwqmRksfztu+EDGAlrcf2iIiLzPYSmcZTckcPUgPjH5Z0j10W6DmoQ0xgu1VXqu3picwAb3+T9HL8Au2A5TVdc8aYnxFx/RgbiSTfQtYBAJOJTSnbUCy8pE1GBMGhh4DRgTBdEBzMmiafs0dgcW7ncQx9OVHTLHcxQgmbdlKaREdK9mM3Ie0ifZ/wE8u3LZq5nHcOTn6JYoXzzTlYJNE26sf9Xs30hmYXNC8= X-MS-TrafficTypeDiagnostic: DB8EUR05HT113: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OFhnDbgr6p9SO4BLC4438ZimNmI6TTaxeVSeEt7PcwaWOFdB1NGN+JRY9/AdRMnW20INcrLP+8UXlj4Od+0vS+gojxMNCeC7D/hMdbm4DtynDpypgAPFZugplG91WqstmevVq602Jw0NRGV2aTyeTzgiE6zA8iqC6DbYpTSUmc9AdcnkDafIFvlhiv6HeTfGFf3atkMkai3vN2232j7kicFrTpEcj0HID/cCqZ+i8nt7/cWDp1qgWEitPuz7u/N6/l0U2ZBLUzeL8s2ipLYO1ngOFIFFeXbpfxLifkF81IOJ3kz5SKV2gcOvRqMBlu2lQkAWxZKcF8+E9Xl2ENEfZCEh/qZLIu4JotaojyRjBkC0xuBiZDHNQ49LP5gFLx17wZmUR1x1TOapSWjg9Q3Gxw== X-MS-Exchange-AntiSpam-MessageData: 0uekkCb1qC6IY/zkfNUrr9+oj9fvMU6I42VyIybPiF4cmBcIB9WHl1NZbxip3szLVHZ76Nl29BU83XoF2czl0L6Hc5MS1/U6tE6wCoM3hYvebUAPhopnx/99iKRXBTdveOw2gyry3KoJg4YdEQR1ZA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6262e6b9-c9d7-4380-29cf-08d9305621e3 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:34:34.6520 (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: DB8EUR05HT113 Subject: [FFmpeg-devel] [PATCH 54/54] avformat/xmv: 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: cgEV+PLEcuMl by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/xmv.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/libavformat/xmv.c b/libavformat/xmv.c index 36816ec005..fbe0f484e2 100644 --- a/libavformat/xmv.c +++ b/libavformat/xmv.c @@ -149,7 +149,6 @@ static int xmv_read_header(AVFormatContext *s) uint32_t file_version; uint32_t this_packet_size; uint16_t audio_track; - int ret; s->ctx_flags |= AVFMTCTX_NOHEADER; @@ -177,10 +176,8 @@ static int xmv_read_header(AVFormatContext *s) avio_skip(pb, 2); /* Unknown (padding?) */ xmv->audio = av_mallocz_array(xmv->audio_track_count, sizeof(XMVAudioPacket)); - if (!xmv->audio) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!xmv->audio) + return AVERROR(ENOMEM); for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) { XMVAudioPacket *packet = &xmv->audio[audio_track]; @@ -214,8 +211,7 @@ static int xmv_read_header(AVFormatContext *s) packet->channels >= UINT16_MAX / XMV_BLOCK_ALIGN_SIZE) { av_log(s, AV_LOG_ERROR, "Invalid parameters for audio track %"PRIu16".\n", audio_track); - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; } } @@ -227,10 +223,6 @@ static int xmv_read_header(AVFormatContext *s) xmv->stream_count = xmv->audio_track_count + 1; return 0; - -fail: - xmv_read_close(s); - return ret; } static void xmv_read_extradata(uint8_t *extradata, AVIOContext *pb) @@ -588,6 +580,7 @@ const AVInputFormat ff_xmv_demuxer = { .long_name = NULL_IF_CONFIG_SMALL("Microsoft XMV"), .extensions = "xmv", .priv_data_size = sizeof(XMVDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = xmv_probe, .read_header = xmv_read_header, .read_packet = xmv_read_packet,