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 CB17045F6B for ; Mon, 19 Jun 2023 06:19:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E952068BF90; Mon, 19 Jun 2023 09:19:34 +0300 (EEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 561BA6808CC for ; Mon, 19 Jun 2023 09:19:27 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687155572; x=1718691572; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yvEmEYODuaDiPoB3pHyQin0S1Xnv5VlkNSiE/xyDd9Y=; b=Rn/9DMjPp2xn7/dNYRzmPpKvarvWg83SLioPmKs+Aj3FIFIn1d8dyssD lJfqh0Jn4ggSby1izZHrJGGOuth3l3DQVtY0zSlNO+Mh5NHukXN0DkLLz uRspFtEZRgwvJ17Vb41MDZFhHQWmPX2Kw/LDq62a5Tf2DCOcOBStaJqm2 UofCZarYdWujgt4lbf6ZHtJxnAeZdED126P5BmNECwzqZIw2qtj7WxIR6 L8in9PMQHrozPZQpF9gTn+CTPoiXcVWjo+fZ33rAwYK18BtyIawjVUtIY s1Vy2d4iaUKsr9fJwQwmB8xLzi8vMwlFZPYNHKk1jb8xhCdID2bk1x4I3 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10745"; a="362089625" X-IronPort-AV: E=Sophos;i="6.00,254,1681196400"; d="scan'208";a="362089625" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2023 23:19:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10745"; a="858099909" X-IronPort-AV: E=Sophos;i="6.00,254,1681196400"; d="scan'208";a="858099909" Received: from desktop-qn7n0nf.sh.intel.com (HELO localhost.localdomain) ([10.239.160.59]) by fmsmga001.fm.intel.com with ESMTP; 18 Jun 2023 23:19:23 -0700 From: Tong Wu To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Jun 2023 14:15:08 +0800 Message-ID: <20230619061509.1363-2-tong1.wu@intel.com> X-Mailer: git-send-email 2.41.0.windows.1 In-Reply-To: <20230619061509.1363-1-tong1.wu@intel.com> References: <20230619061509.1363-1-tong1.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/3] lavu/hwcontext_qsv: fix memory leak for d3d11va 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, 8 insertions(+), 4 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 878ecd886e..1d24a04561 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -665,6 +665,7 @@ static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) static int qsv_d3d11_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) { + int ret = AVERROR_UNKNOWN; #if CONFIG_D3D11VA mfxStatus sts; IDXGIAdapter *pDXGIAdapter; @@ -679,7 +680,8 @@ static int qsv_d3d11_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) hr = IDXGIDevice_GetAdapter(pDXGIDevice, &pDXGIAdapter); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Error IDXGIDevice_GetAdapter %d\n", hr); - goto fail; + IDXGIDevice_Release(pDXGIDevice); + return ret; } hr = IDXGIAdapter_GetDesc(pDXGIAdapter, &adapterDesc); @@ -689,7 +691,7 @@ static int qsv_d3d11_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) } } else { av_log(ctx, AV_LOG_ERROR, "Error ID3D11Device_QueryInterface %d\n", hr); - goto fail; + return ret; } impl_value.Type = MFX_VARIANT_TYPE_U16; @@ -722,11 +724,13 @@ static int qsv_d3d11_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) goto fail; } - return 0; + ret = 0; fail: + IDXGIAdapter_Release(pDXGIAdapter); + IDXGIDevice_Release(pDXGIDevice); #endif - return AVERROR_UNKNOWN; + return ret; } static int qsv_d3d9_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) -- 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".