mesa/main: In register_surface() verify gl_texture_object was found

Verify _mesa_lookup_texture() returned valid pointer before using it.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Juha-Pekka Heikkila
2014-05-08 11:16:54 +03:00
committed by Ville Syrjälä
parent cc5abf0460
commit 0f7958aac2

View File

@@ -145,6 +145,12 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
for (i = 0; i < numTextureNames; ++i) {
struct gl_texture_object *tex;
tex = _mesa_lookup_texture(ctx, textureNames[i]);
if (tex == NULL) {
free(surf);
_mesa_error(ctx, GL_INVALID_OPERATION,
"VDPAURegisterSurfaceNV(texture ID not found)");
return (GLintptr)NULL;
}
_mesa_lock_texture(ctx, tex);