[vlc-commits] d3d11va: Fix memory leak on error

Hugo Beauzée-Luyssen git at videolan.org
Thu Aug 9 10:23:11 CEST 2018


vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Aug  9 09:57:56 2018 +0200| [5a52f2adeace5b7a36866c94310de7b9f2a44442] | committer: Hugo Beauzée-Luyssen

d3d11va: Fix memory leak on error

(cherry picked from commit d88ee7f07c47d1e71797391b0e50c330cd90a4af)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=5a52f2adeace5b7a36866c94310de7b9f2a44442
---

 modules/codec/avcodec/d3d11va.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 48e40f54da..cb515c7fd0 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -582,10 +582,13 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *
     if (FAILED(hr))
         return VLC_EGENERIC;
 
+    char *psz_decoder_name = directx_va_GetDecoderName(input);
+
     if (!directx_va_canUseDecoder(va, adapterDesc.VendorId, adapterDesc.DeviceId,
                                   input, sys->d3d_dev.WDDM.build))
     {
-        msg_Warn(va, "GPU blacklisted for %s codec", directx_va_GetDecoderName(input));
+        msg_Warn(va, "GPU blacklisted for %s codec", psz_decoder_name);
+        free(psz_decoder_name);
         return VLC_EGENERIC;
     }
 
@@ -599,8 +602,6 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *
     processorInput[idx++] = DXGI_FORMAT_420_OPAQUE;
     processorInput[idx++] = DXGI_FORMAT_UNKNOWN;
 
-    char *psz_decoder_name = directx_va_GetDecoderName(input);
-
     /* */
     for (idx = 0; processorInput[idx] != DXGI_FORMAT_UNKNOWN; ++idx)
     {



More information about the vlc-commits mailing list