[vlc-commits] d3d11va: fix leak from a FromWide() call
Steve Lhomme
git at videolan.org
Wed Mar 15 19:17:29 CET 2017
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Wed Mar 15 09:12:02 2017 +0100| [8249db65bdb51c8d469e63de3e5073a58d068ddd] | committer: Jean-Baptiste Kempf
d3d11va: fix leak from a FromWide() call
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8249db65bdb51c8d469e63de3e5073a58d068ddd
---
modules/codec/avcodec/d3d11va.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 4ef9ac8..6cdd166 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -649,6 +649,7 @@ static char *DxDescribe(directx_sys_t *dx_sys)
return NULL;
}
+ char *description = NULL;
DXGI_ADAPTER_DESC adapterDesc;
if (SUCCEEDED(IDXGIAdapter_GetDesc(p_adapter, &adapterDesc))) {
const char *vendor = "Unknown";
@@ -659,17 +660,19 @@ static char *DxDescribe(directx_sys_t *dx_sys)
}
}
- char *description;
- if (asprintf(&description, "D3D11VA (%s, vendor %u(%s), device %u, revision %u)",
- FromWide(adapterDesc.Description),
- adapterDesc.VendorId, vendor, adapterDesc.DeviceId, adapterDesc.Revision) < 0)
- return NULL;
- IDXGIAdapter_Release(p_adapter);
- return description;
+ char *utfdesc = FromWide(adapterDesc.Description);
+ if (likely(utfdesc!=NULL))
+ {
+ if (asprintf(&description, "D3D11VA (%s, vendor %u(%s), device %u, revision %u)",
+ utfdesc,
+ adapterDesc.VendorId, vendor, adapterDesc.DeviceId, adapterDesc.Revision) < 0)
+ description = NULL;
+ free(utfdesc);
+ }
}
IDXGIAdapter_Release(p_adapter);
- return NULL;
+ return description;
}
/**
More information about the vlc-commits
mailing list