g3dvl: Return BadAlloc if we can't create an XvMC surface.
authorYounes Manton <younes.m@gmail.com>
Wed, 14 Jan 2009 03:58:43 +0000 (22:58 -0500)
committerYounes Manton <younes.m@gmail.com>
Mon, 19 Jan 2009 02:40:10 +0000 (21:40 -0500)
src/gallium/state_trackers/g3dvl/vl_surface.c
src/xvmc/surface.c

index 911469f966a2281cb8097d1cd2316f7abf7b4351..612438f2ac3acc845435dcd26f901136d748453a 100644 (file)
@@ -51,6 +51,12 @@ int vlCreateSurface
 
        sfc->texture = vlGetPipeScreen(screen)->texture_create(vlGetPipeScreen(screen), &template);
 
+       if (!sfc->texture)
+       {
+               FREE(sfc);
+               return 1;
+       }
+
        *surface = sfc;
 
        return 0;
index 67c179e66d321f8c8324b25682a461a521d62fa6..7c5f45bd346087e4f91cf53a6751c23f70de8edd 100644 (file)
@@ -73,14 +73,13 @@ Status XvMCCreateSurface(Display *display, XvMCContext *context, XvMCSurface *su
 
        assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx))));
 
-       vlCreateSurface
-       (
-               vlContextGetScreen(vl_ctx),
-               context->width,
-               context->height,
-               vlGetPictureFormat(vl_ctx),
-               &vl_sfc
-       );
+       if (vlCreateSurface(vlContextGetScreen(vl_ctx),
+                           context->width, context->height,
+                           vlGetPictureFormat(vl_ctx),
+                           &vl_sfc))
+       {
+               return BadAlloc;
+       }
 
        vlBindToContext(vl_sfc, vl_ctx);