directx_va: Fix leak
authorHugo Beauzée-Luyssen <hugo@beauzee.fr>
Fri, 6 Oct 2017 14:18:30 +0000 (16:18 +0200)
committerHugo Beauzée-Luyssen <hugo@beauzee.fr>
Fri, 6 Oct 2017 14:19:32 +0000 (16:19 +0200)
refs #18849

modules/codec/avcodec/directx_va.c

index ea2c209..1f51e4c 100644 (file)
@@ -274,9 +274,9 @@ char *directx_va_GetDecoderName(const GUID *guid)
             return strdup(DXVA_MODES[i].name);
     }
 
-    char *psz_name = malloc(36);
-    if (likely(psz_name))
-        asprintf(&psz_name, "Unknown decoder " GUID_FMT, GUID_PRINT(*guid));
+    char *psz_name;
+    if (asprintf(&psz_name, "Unknown decoder " GUID_FMT, GUID_PRINT(*guid)) < 0)
+        return NULL;
     return psz_name;
 }