From patchwork Sat Apr 24 12:29: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: 27270 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:49c5:0:0:0:0:0 with SMTP id w188csp2084445yba; Sat, 24 Apr 2021 05:44:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSwNsyKfhHGNGaaxgvL6l1tR+C6zoAcRQK1Qh3217DdbvGEEuPBVbsiXdJuv/VgQN9+ezS X-Received: by 2002:a17:907:ea7:: with SMTP id ho39mr9054584ejc.315.1619268250543; Sat, 24 Apr 2021 05:44: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 d9si7761035edv.176.2021.04.24.05.44.09; Sat, 24 Apr 2021 05:44: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="u4Vcl/nf"; 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 4C5C8689EBD; Sat, 24 Apr 2021 15:44:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-oln040092065070.outbound.protection.outlook.com [40.92.65.70]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4E31E68825A for ; Sat, 24 Apr 2021 15:43:59 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YmLVo/awKtof2uFCY69+n4YmznvxLP+lihEkCw+BA/J7I/ksW2BUCcrCNByOg5lO9CvEJpPovNeiPHtgAoHriJfh+s1vO6oCLBoUSZ9DeROVgugdqVlRnP6ch+gP5rRy5d6HEInf2xv9BgYj/OKFCIybEonOS9QhrH22vBjwoBvenT+ICVQlqszx1HnlCNjCf0KZZFEVetbTaus/b1KrL7KBMirgiZ4EIdXzE2fXuj3drCc2M6iP5ebaQlguZPlO36AIr26y8TF4kVaa2PvJDoxpmELUNwKBlciQ8S6lEtZpn1IC2SjVJyVCuGfyQ7olHN0xG6t7ZsCyzA9IYhn58Q== 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=pg/XalIIlRQB2SZ5P5fw2lCzeR5h5WY3hfBPb7jGaLw=; b=Nklb64Ky/0qzWsZlwMtNDKW8AbZf5zwso2BgydnWinQJYrXOoEU+xSyHcLiXXhBDSiQFmOFDhFn1Dpu9Qe1LrFCGCob+ylUG7QDbLbWnXG3xhSPPtOQnQwy7YutV1PeQ9gYmzQtjTr7dc7YX2uIvVdwPAVRRHWS1f2gUlUNkAVZ9FO/CJdTqNwAcpUlpnKAT+cNSOSzMyOWrK9Z+4t3dsXyxGNzBz7FD1CGUCW0wxkM/kL2iGYQpOlaULjVWuSGD2cO3pCHe5wJX6G6WZfIw8nsOR0BNDIdxN7zda7kXlV3l0O9HvYDrdJgA/SgJClqWmmyZKSGrFM3VvQYfb+bJ/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=pg/XalIIlRQB2SZ5P5fw2lCzeR5h5WY3hfBPb7jGaLw=; b=u4Vcl/nfRL5xAErg3y6V67tXz+5KgBJVQfRSnGMLdD3PfK9hLh72OakNLxqyVDrq/uJl4oP6gI+K96alZmxIO4tr44qBqg8WQopCbeln2F6dXbXR+qEWr0Z7gMxzTJR+rB3Y82ypBqFGXCmibPkIDtg5kQ20lcuEA50RxEKd+EPVQf+uf4iAntZ3WKg8djUi6AxQnXwGRrq96A6mYiFfQgW+gqBYl0A7r5YJcUAi9ZH40LwPc2ZpHpUj6+0g3OsA+cYcG2KEy3iOfYlIzF3+sGBRFd1DJZ3OT7phs/H+afJ4K5FZDEEnf8NhnMtmCeHwvF2YSjSMsp/SuwTtrBDfbQ== Received: from DB5EUR01FT004.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e1a::51) by DB5EUR01HT096.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e1a::431) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Sat, 24 Apr 2021 12:29:50 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e1a::41) by DB5EUR01FT004.mail.protection.outlook.com (2a01:111:e400:7e1a::112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Sat, 24 Apr 2021 12:29:50 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:0D58FFCC6FF136FE63B7FD981632500BE4A188BE80AD3982C0C647BA00565E27; UpperCasedChecksum:1770BE06AB2FD51908B489E6734DCAAE4685672DB80D9E634AA0EE38AC4984E8; SizeAsReceived:7594; Count:48 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.4065.025; Sat, 24 Apr 2021 12:29:32 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 24 Apr 2021 14:29:24 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [uHf2PZDb11OJj11Vqeb82tTAQ0tFpZxv] X-ClientProxiedBy: ZR0P278CA0070.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::21) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210424122924.113829-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.193.248.86) by ZR0P278CA0070.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Sat, 24 Apr 2021 12:29:32 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 9dc25e23-f076-4dc0-15a7-08d9071c9cfe X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UL2UDcFXhKBVDdW3S05RF0ZfNqlT0k8T0086TE41PqY77rSdmXQHATQUAUhLbk0QIfWKKhmlJ+OiadSDi0zsxYVVnLWZ6cUNLLqzFuNan4fC2q/Hfq+3LxE4pWk2R/YmRO0pWtInVGSy+zNggMZwt4kkd7RXEQ+6I83j5QrTAe3eQuekgG1Z139WQggsOsvR0vyEuhWqqX42uTvGBGguqbjRNCKwmZSJo3iOH25m/0aC+piot0lA60zNSTAd6bQWFqvvGA2lvClIAsiUK31gXJymY75ITxM0cKNIB2rRUcVnMjTV/m2yC1K8Fakx2XgSVnLpP8sNraoOTzgtj3wJ2hMYV1do6msGxBqbJPPcVOIIIF7SO0JzItlgIWETLxBEZmUqfcz/za/qiWFVWJfJ163YhnImDzA42/rbFbc+TCzf2dipPU/DdTIdBoEZOW5liHdmFat2auSRV0LLrKkr1f30+TpYJ7dJjChfuPjLxeerv8DJpwzi2NsEOfithChut8WlkROm3MmwutuMbAu+NZf0e9md8qQy0tGvzmql9c3wEmDAQLx3jS7zrYBtXid5gw/XACaBsN90plu4SHZNX9x3AdVRHbP4GGXVsasxaBX3zX+Et/iUFwn8SeJcMHDJVgTEZgDXhfQDzdwVZESZCFd735T/TuAzFbbBOjZsbtxDBeJ1XB4wSDkJvTLq5tNMVfkZMwS74GzHw== X-MS-TrafficTypeDiagnostic: DB5EUR01HT096: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0KemdYs+1uDvSW0nt3ewyzgnQDew8zXFGt80i+/VCnReSItCy5gYNSbXkiOFN8h1wjxtybW5JgGNnWnJWdxB5Zj+AtauaCPGG6PQiql3ZWmh7mq9rVVDVF96lu2NVr9a4MhiOqy8NQW4frakWqXJ+tcmR0+wlrNp1JEZJ3RSsLUIFUXzIDCvVf6DkmqtQ64jI1MEKtgbMPsqcyXeWHb01n4qRsYVCdt9YNjnALsEcJRRlacAGT9KPjNawZDag4cifZMvjGOq6fpjebehvV3dx38AgryrCIYvW+sfOizSvgV5I5wsUrwheqtxT2sW6rTMQEJosUpVcWgyYUpqIjShbTgavi6Tu8rBf6A2Y19aW/XTTrWIScHUM+PPa/ufVdnspir/YvlhiJUtcXCDa7ldMg== X-MS-Exchange-AntiSpam-MessageData: 02lpLIHzudGaLljL/wfGZFJzioAIGTmLZ27rv20O1XzRWMQlvgoCOJYt6ysuw4Gn46C/rxdtWe1wr5bvwSFkeaAkiN4wgxKs93AK+qH4tNbQ6w0UA6fCNwulXD7I5Ll6hfV86Qk3PSBsPDm9Uc9mcg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9dc25e23-f076-4dc0-15a7-08d9071c9cfe X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 12:29:32.7000 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB5EUR01FT004.eop-EUR01.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: DB5EUR01HT096 Subject: [FFmpeg-devel] [PATCH 8/8] avcodec/avcodec: Document current behaviour for extradata 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: /2d1dlpqzVQA Content-Length: 1560 Despite the documentation saying that it is not freed by libavcodec for a decoder, avcodec_free_context() does so and has been doing so since this function has been added more than seven years ago. Honouring the current documentation in avcodec_free_context() would add memleaks to all users of it that don't free their extradata manually; given how long this behaviour has been around we can safely assume that these are many (i.e. the fftools are among them, as is libavformat as well as parts of libavcodec itself). Therefore adapt the documentation to match actual behaviour. This fixes ticket #5027. Signed-off-by: Andreas Rheinhardt --- libavcodec/avcodec.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index b9b487be41..4596d12647 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -633,6 +633,8 @@ typedef struct AVCodecContext { * Must be allocated with the av_malloc() family of functions. * - encoding: Set/allocated/freed by libavcodec. * - decoding: Set/allocated/freed by user. + * Additionally, avcodec_free_context() frees it regardless of whether + * the context is used for encoding or not. */ uint8_t *extradata; int extradata_size;