d3d11va: Fix memory leak on error
authorHugo Beauzée-Luyssen <hugo@beauzee.fr>
Thu, 9 Aug 2018 07:57:56 +0000 (09:57 +0200)
committerHugo Beauzée-Luyssen <hugo@beauzee.fr>
Thu, 9 Aug 2018 07:58:52 +0000 (09:58 +0200)
modules/codec/avcodec/d3d11va.c

index 1d6a8f5..dde2e75 100644 (file)
@@ -586,10 +586,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;
     }
 
@@ -603,8 +606,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)
     {