From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id BB1F345B87 for ; Fri, 24 Mar 2023 13:20:38 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6AA5568C7DC; Fri, 24 Mar 2023 15:20:35 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D748668C757 for ; Fri, 24 Mar 2023 15:20:29 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 9EDFE2404EA for ; Fri, 24 Mar 2023 14:20:29 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id wR3gpg16HqqB for ; Fri, 24 Mar 2023 14:20:29 +0100 (CET) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 3AF3E240178 for ; Fri, 24 Mar 2023 14:20:29 +0100 (CET) Received: by lain.khirnov.net (Postfix, from userid 1000) id 254B81601B2; Fri, 24 Mar 2023 14:20:29 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <41a53887-5b12-6be0-9359-9e807ba21689@gmail.com> References: <20230320233408.134255-1-jeebjp@gmail.com> <20230320233408.134255-3-jeebjp@gmail.com> =?utf-8?q?=3CGV1P250MB07374991CA?= =?utf-8?q?66F51254EC24458F849=40GV1P250MB0737=2EEURP250=2EPROD=2EOUTLOOK=2E?= =?utf-8?q?COM=3E?= <41a53887-5b12-6be0-9359-9e807ba21689@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches Date: Fri, 24 Mar 2023 14:20:29 +0100 Message-ID: <167966402912.27013.17400181154374732459@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v0 02/14] avcodec: move AVCodecInternal allocation to avcodec_alloc_context3 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Quoting James Almer (2023-03-24 14:02:40) > On 3/24/2023 9:07 AM, Andreas Rheinhardt wrote: > >> @@ -174,6 +190,8 @@ void avcodec_free_context(AVCodecContext **pavctx) > >> > >> avcodec_close(avctx); > >> > >> + av_freep(&avctx->internal); > > Moving this to avcodec_free_context() creates a leak when using > > avcodec_close()+av_free(). This can be fixed by allocating the > > AVCodecContext and the AVCodecInternal jointly. > > Can't we just declare that doing av_free() on a AVCodecContext is not a > valid API usage? Every other struct with an specific free function is > very clear about it being the only way to free them. Sadly I expect many callers still do this, even though avcodec_free_context() has existed since 2014. The proper solution is to deprecated avcodec_close(), but that needs a new parser API. -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".