From patchwork Mon Apr 19 02:00: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: 26962 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:49c5:0:0:0:0:0 with SMTP id w188csp681940yba; Sun, 18 Apr 2021 19:01:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyujIxWLHkAdEjEp5Kx0QB2HUmAX0IuXroDFhQkSbtOJjmHOpf0DzIHkdIi3WnDdYxJl0Nq X-Received: by 2002:a17:906:3945:: with SMTP id g5mr19224286eje.427.1618797677193; Sun, 18 Apr 2021 19:01: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 n18si5092289eja.397.2021.04.18.19.01.16; Sun, 18 Apr 2021 19:01: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=OyFgW4UW; 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 AD641680969; Mon, 19 Apr 2021 05:01:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-oln040092072069.outbound.protection.outlook.com [40.92.72.69]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0DDD76806E5 for ; Mon, 19 Apr 2021 05:01:07 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xz5JHaaWq97tAJtcRhzgHmnJLZuFzsQL/dDes9Hyv9dYN8iczkWZDGPcBmN0NN2zSIfHLbP7r+zt/xo6RZy9dIH+vjedbrh2Dmr4jS9Yvh84qPc6sC14R8Aq423LB+6jk5G+JWV+7C6O033/KkU2V1RBGTAr+1omoaDJaq9vzRsBtVcJMwIx7HTFWKKDZViOqjYXpYKSBFFTde4rEe64vSNHpkKncyHpz2VpSbwYlnTmXdKKXjKxg3RPvsMLSENnbLj27NbGDxgZ0DA5AV3em6Jpc2zCetOLc7QLxUL1iy/E8+qM5fgkKYjTT3friyQpyYTpVNILVrKHsbD3qsb8nQ== 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=mvNSNBWje7hYraJ4CG1MN1sgXYvKJ/Lp6vNUu6YgWFw=; b=jLIl5rL7VtkP+LDSWhKTIZ2ACE3EHoJKjtmbXgYGpTv1vCGdCHOZmuTcZHruMV16uaHOyiTO9hI5dRdt+8RAE1J1/mAH5U/BQ+Z+4M8NJik7QGq7VYTGl3YuIevG3wO9eRWS/Mgme7WWzNgRi9ZSaqrOHeNUPeLCuHB0l4WXvktis/qrCmfJbC876K63vaKYWPBdUY+JOz3FWFb01rxAI7LDsOLJSHHxtxppmC5PNWrEIQqkpC+Re3QSZZTrT/feVA9DrTBHpVCoXXprsogD7+Ff9eSXdYJ7cBid6+ORlK74kltu2JIfB33oAW6eRD8CDt839Ms/lXjcKWWc47ycig== 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=mvNSNBWje7hYraJ4CG1MN1sgXYvKJ/Lp6vNUu6YgWFw=; b=OyFgW4UW+Ox800Gh/T3MS9dwkQM5mw77S2mZ45/3sUg2D9XF6+2Tm8i5vev54NfohXLdmXNNUfOKrb43lUKZLPQ32GLyoZ9EFhFEJmWDAVg7cCpnmEtd3WzDagXUML/cWFZewxJSDO4Xf6R+2Fn8wccHkvF1d/vxHXS8AaP7NgXLrqBR7t6/UpOC4Ag5mmC2hm4sWO5UFVlwIgZy8BwN+FqRMbM/OvJXRiAz5+ZPjf6JR7+Cmx4kBA18R/p8ove7ML5p6NedQ0h0awOhfe4tK+GnOUYzrwge5gmgSiuGlwGp2WvSqHcjOIwZ54lS3Hml7V0VyLUX982PryeyvKj3VA== Received: from DB5EUR03FT025.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e0a::4f) by DB5EUR03HT092.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e0a::413) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16; Mon, 19 Apr 2021 02:01:05 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e0a::4d) by DB5EUR03FT025.mail.protection.outlook.com (2a01:111:e400:7e0a::104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Mon, 19 Apr 2021 02:01:05 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:B02AA895B57CA20A0BE2B847E1B2468562F7DA27D476CC55159D053C9A976B65; UpperCasedChecksum:16F0A744E91F7B37A5C8DBF51905833F0644F600BDF977765BBF01E2241B2ECE; SizeAsReceived:7413; Count:46 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::45bb:c44f:2b75:23b7]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::45bb:c44f:2b75:23b7%5]) with mapi id 15.20.4042.024; Mon, 19 Apr 2021 02:00:47 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Apr 2021 04:00:30 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 X-TMN: [AJD59ioWPhOAEIijOrEP1cNtC8CoDwNL] X-ClientProxiedBy: AM8P190CA0029.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:219::34) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210419020036.92826-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.96) by AM8P190CA0029.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:219::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Mon, 19 Apr 2021 02:00:46 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 91c20cd7-a3d3-4ac9-6f98-08d902d6f2a5 X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UL5of3Fna0zoENiR+FBTuR3TZH/qKkkgc9jUd76BdNoGbTmWxf+59siQIy52KeDcjKXFUoV8ORULX5WRihxoLucSSCNxEcflVQ5BX++zupzBaKk9QdxjRQbCzHxvkl7LUTDOFW7+6JL6dtf7zzS0h8xOio6Ejm9nYwaQ2nUJa6ZtYHzhQGBRSV++AsLbSbLbSkWU/sWhoZYKpssQNy9Au5vZLGAE/84gmtZnOLk0hGD2O6SNt7Vq0TEq4ZyTDUYGRfUseeik9JpMp/OyF+JqSSTebyh+PiLK4b6VQhNkSacv8/1sVzMyzR6jB6Uk/+cJ7y/6awT6LoXI4jCShVvxLs0//o7uoOWOoejh5+rfr89pJ5h0NJQ48r1BrKWq6rdpVX4S8fHSYjHcd3+eZ+SvoSBwJIpgsnMcRZxe1q3Jnt0m7oszNlg7sjW6EokLEr22VipV7XjhQZsqdFcVWvjaY6URggEdmRWlZ+JANGEZwiDia03WpJsFclToveWMISv89bStVNmeJm/j4cUVGqeP9ZtdhzxdoMiKQE4FPwFJIIZWBfmjjKXBZF2PMrMamVwygKmkk6tcBzpmDf1oyvD+YrVeyPsx8c0i7i5VVxdVPm8/H0hyDwL46HGCMa/qcXJ2QH64gdKLCQC5SxZI07nmTRWiF5l385P8D8rFyBwZO6aLuVdNxqWa5WS/Q23ZdsmnHqb854caI/9VA== X-MS-TrafficTypeDiagnostic: DB5EUR03HT092: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cyAOWXXb+qUzwoh4C1YcQwP0sVxOIadaeZbCZwa3/APbFjLLHL7ZIxVTaAP9OOxPF3MNiUYixeCUW8WeBaj/c5qMFHYbSsz+uRjIUABkrF9ajUjLdIoytXSnPSos56duNLGsgingOgcWU+yd3Ev+b9ZbAk4qk8F0QfQw+EZYGumEKEJbTNklz8CvJ/9++QP0YilK9ZQhsqPVyDcFPbOhYx8yj5VQxe0JXrPO69yQnfvUrKlqicjDaBD2dH//5XuklBy7MyNBR332n6opZ+K5mNlxMeI6OV7lXxICXi/bsqxAmyac693+GsUHwZGfCGHBNMwVbQ0fuulPrbKawqATO7xwXlMlpTBkcaUbUrXS3W0Aw2AdKHty7Rd3pmBn7RjS3XXovJEFYAYh3vAukXD+mg== X-MS-Exchange-AntiSpam-MessageData: pGEFN5JU1hkQsfLCXNU2Cw3ms1Ssnx/M8GrXm67KUo+BwoWLHNFflsy5dZCxs7rAhrbsJp1V3xaicOtQsmpiSewhlvsyOrifLi4sMlRU6+59lG/xDeq8X3tHp/erchUs1aEVDVh7oR37TOMhR3vS2A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91c20cd7-a3d3-4ac9-6f98-08d902d6f2a5 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2021 02:00:47.0649 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT025.eop-EUR03.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: DB5EUR03HT092 Subject: [FFmpeg-devel] [PATCH 1/7] avcodec/avcodec: Actually honour the documentation of subtitle_header 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: yBqCqVMhJpW/ Content-Length: 1415 It is only supposed to be freed by libavcodec for decoders, yet avcodec_open2() always frees it on failure. Furthermore, avcodec_close() doesn't free it for decoders. Both of this has been changed. Signed-off-by: Andreas Rheinhardt --- This might be squashed with the next patch. libavcodec/avcodec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 760a98d8ef..24f6922d4f 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -418,7 +418,8 @@ FF_ENABLE_DEPRECATION_WARNINGS av_dict_free(&tmp); av_freep(&avctx->priv_data); - av_freep(&avctx->subtitle_header); + if (av_codec_is_decoder(avctx->codec)) + av_freep(&avctx->subtitle_header); #if FF_API_OLD_ENCDEC av_frame_free(&avci->to_free); @@ -589,7 +590,9 @@ FF_DISABLE_DEPRECATION_WARNINGS av_frame_free(&avctx->coded_frame); FF_ENABLE_DEPRECATION_WARNINGS #endif - } + } else if (av_codec_is_decoder(avctx->codec)) + av_freep(&avctx->subtitle_header); + avctx->codec = NULL; avctx->active_thread_type = 0;