[vlc-commits] directx_va: Fix leak

Hugo Beauzée-Luyssen git at videolan.org
Fri Oct 6 16:19:47 CEST 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Oct  6 16:18:30 2017 +0200| [91be8dac2039a34d399e8db4c36b5d5b59a7118f] | committer: Hugo Beauzée-Luyssen

directx_va: Fix leak

refs #18849

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=91be8dac2039a34d399e8db4c36b5d5b59a7118f
---

 modules/codec/avcodec/directx_va.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index ea2c2095a6..1f51e4c227 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -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;
 }
 



More information about the vlc-commits mailing list