st/mesa: check ureg_create() retval in create_pbo_upload_vs()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 9 Feb 2016 10:40:08 +0000 (11:40 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 10 Feb 2016 17:26:20 +0000 (18:26 +0100)
This avoids a possible NULL dereference because ureg_create() might
return a NULL pointer.

Spotted by coverity.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/mesa/state_tracker/st_cb_texture.c

index f2b607c3a1d3194ffcd08098120e8a61637e2dd1..d53126a9441239c52cf6a287fab015d94201f059 100644 (file)
@@ -1132,6 +1132,8 @@ create_pbo_upload_vs(struct st_context *st)
    struct ureg_dst out_layer;
 
    ureg = ureg_create(TGSI_PROCESSOR_VERTEX);
+   if (!ureg)
+      return NULL;
 
    in_pos = ureg_DECL_vs_input(ureg, TGSI_SEMANTIC_POSITION);