[Mesa-dev] [PATCH 15/20] mesa/main: Verify calloc return value in register_surface()

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Wed May 14 10:56:01 PDT 2014


Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/mesa/main/vdpau.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c
index d974593..f1b3ece 100644
--- a/src/mesa/main/vdpau.c
+++ b/src/mesa/main/vdpau.c
@@ -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;
-- 
1.8.1.2



More information about the mesa-dev mailing list