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 C0E154622A for ; Tue, 13 Jun 2023 04:24:17 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 05BE068C35B; Tue, 13 Jun 2023 07:24:15 +0300 (EEST) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 722B768AD1B for ; Tue, 13 Jun 2023 07:24:08 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id 806511060154 for ; Tue, 13 Jun 2023 04:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1686630248; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=BhjxIVuKjeFe56A8wlI6ncK1/hawDxzO28dpC2Bo6s8=; b=H8gjCE7xTYZhQ8FylRypTKLxycaV1oZrmOAOmyEheKE7TXkDO+UbKoFHUTFfXYZi ZcBGIC2acfvM31mXtze55XsZn6fOJYGXiCF58SwsyAQDy0l+olhfshJ9xOcaKN1cLFP eMI4lhc7fyUfBnrsxD7cva9Q+xqymwegfP++wFKidOlJbUxY3VJW9Yp3nVP/Xr7puQW MvSImdl7SHKRd9BBcXcmof5ipWUZheyxzeDZ/p5+h3P8yIhGCcmdfD2HXjCvhiCOyEa QSVeulmcjtF+279cpz/+k/aSyF2UCG0iivfwpFiyMOOdJn2j2xZSqwFkaZGuwu+g1mY 2BMFTVXOTw== Date: Tue, 13 Jun 2023 06:24:08 +0200 (CEST) From: Lynne To: FFmpeg development discussions and patches Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_228617_1792012058.1686630248166" Subject: [FFmpeg-devel] [PATCH 5/5] vulkan_decode: fix small memory leak 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: ------=_Part_228617_1792012058.1686630248166 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit This small memory leak was essentially responsible for keeping decoding working at all. The issue is that the codec profile must be attached to the frames context. We created the codec profile at decoder creation time. Which meant that if the decoder was destroyed, the context became essentially useless, and segfaulted as the profile was a hanging pointer. This was an issue that happened when seeking through H264. This requires using the new AVHWFramesContext.opaque field, as otherwise, the profile attached to the decoder will be freed before the frames context, rendering the frames context useless. Patch attached. ------=_Part_228617_1792012058.1686630248166 Content-Type: text/x-diff; charset=us-ascii; name=0005-vulkan_decode-fix-small-memory-leak.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0005-vulkan_decode-fix-small-memory-leak.patch >From 7d8f1c73308dd29dbf2d46dc09d85808aa1cc6be Mon Sep 17 00:00:00 2001 From: Lynne Date: Tue, 13 Jun 2023 06:13:10 +0200 Subject: [PATCH 5/5] vulkan_decode: fix small memory leak This requires using the new AVHWFramesContext.opaque field, as otherwise, the profile attached to the decoder will be freed before the frames context, rendering the frames context useless. --- libavcodec/vulkan_decode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index 81085273d8..5aad8b213b 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -584,6 +584,8 @@ static void free_common(void *opaque, uint8_t *data) s->hwctx->alloc); ff_vk_uninit(s); + + av_free(ctx); } static int vulkan_decode_bootstrap(AVCodecContext *avctx, AVBufferRef *frames_ref) -- 2.40.1 ------=_Part_228617_1792012058.1686630248166 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". ------=_Part_228617_1792012058.1686630248166--