mesa/main: Verify calloc return value in register_surface()
[mesa.git] / src / mesa / main / vdpau.c
index d9745939391cf50a13ad2b7885039447be571598..f1b3eceee3166ce40045df530822b861873d92eb 100644 (file)
@@ -132,6 +132,11 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
    }
 
    surf = CALLOC_STRUCT( vdp_surface );
+   if (surf == NULL) {
+      _mesa_error_no_memory("VDPAURegisterSurfaceNV");
+      return (GLintptr)NULL;
+   }
+
    surf->vdpSurface = vdpSurface;
    surf->target = target;
    surf->access = GL_READ_WRITE;