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 27A7745EC1 for ; Fri, 16 Jun 2023 12:10:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B236468C0F7; Fri, 16 Jun 2023 15:10:28 +0300 (EEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9BCCF68C00B for ; Fri, 16 Jun 2023 15:10:21 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686917426; x=1718453426; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6R+4kzLWRNQIFvI6DhwPmyokU+zV5fqm/Iy1AeV9c8E=; b=Y34I5EYAL2v8qF0zOpp4pFeMbZVvCqhit4MBl6kvDAMyFYe/WHvRnLNA 0Jq+PTZFvOB0tn5p1mOvo6DJptdALksYsC85H1Bu9V8bRweLr1PrY+atW FtLeRFbmt3lI0xYZ5xMihIjdGjhgmuEEHEs+at6oGqXXXYO06ECkA1Ta7 rgxFuygauS1Va7t/2anEmDnWRoPUHTUemSZYzdGt5KuZxSDKuIvfBa94Q xcQSOZldhJGNvyzkzAz3Iv5LMNKto9jPyJJS96ArPL6JLdKytfMvK79ek 53G+7HAiuvNshCSd2BY83joDwyxPjYePcwmKbwWyn8xxqptImKwFF6bof w==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="359209870" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="359209870" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 05:10:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="742656103" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="742656103" Received: from desktop-qn7n0nf.sh.intel.com (HELO localhost.localdomain) ([10.239.160.59]) by orsmga008.jf.intel.com with ESMTP; 16 Jun 2023 05:10:13 -0700 From: Tong Wu To: ffmpeg-devel@ffmpeg.org Date: Fri, 16 Jun 2023 20:05:57 +0800 Message-ID: <20230616120557.75-2-tong1.wu@intel.com> X-Mailer: git-send-email 2.41.0.windows.1 In-Reply-To: <20230616120557.75-1-tong1.wu@intel.com> References: <20230616120557.75-1-tong1.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] lavu/hwcontext_qsv: fix memory leak for d3d9 impl 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: Tong Wu 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: Signed-off-by: Tong Wu --- libavutil/hwcontext_qsv.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 931f905a51..4cbe8cc494 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -756,25 +756,28 @@ static int qsv_d3d9_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) hr = IDirect3DDeviceManager9_LockDevice(devmgr, device_handle, &device, TRUE); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Error LockDevice %d\n", hr); + IDirect3DDeviceManager9_CloseDeviceHandle(devmgr, device_handle); goto fail; } hr = IDirect3DDevice9Ex_GetCreationParameters(device, ¶ms); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Error IDirect3DDevice9_GetCreationParameters %d\n", hr); + IDirect3DDevice9Ex_Release(device); goto unlock; } hr = IDirect3DDevice9Ex_GetDirect3D(device, &d3d9ex); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Error IDirect3DDevice9Ex_GetAdapterLUID %d\n", hr); + IDirect3DDevice9Ex_Release(device); goto unlock; } hr = IDirect3D9Ex_GetAdapterLUID(d3d9ex, params.AdapterOrdinal, &luid); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Error IDirect3DDevice9Ex_GetAdapterLUID %d\n", hr); - goto unlock; + goto release; } impl_value.Type = MFX_VARIANT_TYPE_PTR; @@ -784,13 +787,18 @@ static int qsv_d3d9_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) if (sts != MFX_ERR_NONE) { av_log(ctx, AV_LOG_ERROR, "Error adding a MFX configuration" "DeviceLUID property: %d.\n", sts); - goto unlock; + goto release; } ret = 0; +release: + IDirect3D9Ex_Release(d3d9ex); + IDirect3DDevice9Ex_Release(device); + unlock: IDirect3DDeviceManager9_UnlockDevice(devmgr, device_handle, FALSE); + IDirect3DDeviceManager9_CloseDeviceHandle(devmgr, device_handle); fail: #endif return ret; -- 2.41.0.windows.1 _______________________________________________ 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".