[vlc-devel] [RFC 27/38] video_output/direct_draw: replaced usage of	xmalloc
    Filip Roséen 
    filip at videolabs.io
       
    Mon Jun 27 13:43:38 CEST 2016
    
    
  
---
 modules/video_output/win32/directdraw.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/modules/video_output/win32/directdraw.c b/modules/video_output/win32/directdraw.c
index c2f5eea..4d5504e 100644
--- a/modules/video_output/win32/directdraw.c
+++ b/modules/video_output/win32/directdraw.c
@@ -1455,8 +1455,16 @@ static int FindDevicesCallback(vlc_object_t *object, const char *name,
 {
     enum_context_t ctx;
 
-    ctx.values = xmalloc(sizeof(char *));
-    ctx.descs = xmalloc(sizeof(char *));
+    ctx.values = malloc(sizeof(char *));
+    ctx.descs = malloc(sizeof(char *));
+
+    if( unlikely( !ctx.values || !ctx.desc ) )
+    {
+        free( ctx.values );
+        free( ctx.desc );
+        return 0;
+    }
+
     ctx.values[0] = strdup("");
     ctx.descs[0] = strdup(_("Default"));
     ctx.count = 1;
-- 
2.9.0
    
    
More information about the vlc-devel
mailing list