From 191737b9c99e7ce3fa2796a5c4963eab73d7de13 Mon Sep 17 00:00:00 2001 From: Hui Jin Date: Fri, 26 Jul 2019 13:27:38 +0800 Subject: vo_d3d11/hwdec_dxva2dxgi: fix memory leak that 'ctx11' be not release 'ctx11' be not release when d3d11 hwdec be uninit with 'mapper_uninit' method. --- video/out/d3d11/hwdec_dxva2dxgi.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'video/out') diff --git a/video/out/d3d11/hwdec_dxva2dxgi.c b/video/out/d3d11/hwdec_dxva2dxgi.c index 97471d02cb..8dbb1cf65d 100644 --- a/video/out/d3d11/hwdec_dxva2dxgi.c +++ b/video/out/d3d11/hwdec_dxva2dxgi.c @@ -148,7 +148,9 @@ static int mapper_init(struct ra_hwdec_mapper *mapper) struct priv_owner *o = mapper->owner->priv; struct priv *p = mapper->priv; + ID3D11Device_AddRef(o->dev11); p->dev11 = o->dev11; + IDirect3DDevice9Ex_AddRef(o->dev9); p->dev9 = o->dev9; ID3D11Device_GetImmediateContext(o->dev11, &p->ctx11); @@ -409,6 +411,10 @@ static void mapper_uninit(struct ra_hwdec_mapper *mapper) for (int i = 0; i < p->queue_len; i++) surf_destroy(mapper, p->queue[i]); + + SAFE_RELEASE(p->ctx11); + SAFE_RELEASE(p->dev9); + SAFE_RELEASE(p->dev11); } static int mapper_map(struct ra_hwdec_mapper *mapper) -- cgit v1.2.3