Mesa (master): mesa/main: Verify calloc return value in register_surface()

Ville Syrjala vsyrjala at kemper.freedesktop.org
Thu Jun 26 12:47:13 UTC 2014


Module: Mesa
Branch: master
Commit: cc5abf046050b2a25c5f4966662d3388302b3cf2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cc5abf046050b2a25c5f4966662d3388302b3cf2

Author: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Date:   Thu May  8 10:34:50 2014 +0300

mesa/main: Verify calloc return value in register_surface()

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.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;




More information about the mesa-commit mailing list