r300g: return NULL texture early if buffer_create fails
authorMarek Olšák <maraeo@gmail.com>
Wed, 9 Jun 2010 18:16:00 +0000 (20:16 +0200)
committerMarek Olšák <maraeo@gmail.com>
Wed, 9 Jun 2010 18:17:27 +0000 (20:17 +0200)
src/gallium/drivers/r300/r300_texture.c

index 5a013e2a25a28a1ce79ce6c9d0895a495071d425..c95a3f79af1ca263c54e032a15d9bb3ccebecf47 100644 (file)
@@ -979,16 +979,16 @@ struct pipe_resource* r300_texture_create(struct pipe_screen* screen,
     tex->buffer = rws->buffer_create(rws, 2048, base->bind, tex->domain,
                                      tex->size);
 
+    if (!tex->buffer) {
+       FREE(tex);
+       return NULL;
+    }
+
     rws->buffer_set_tiling(rws, tex->buffer,
             tex->pitch[0] * util_format_get_blocksize(tex->b.b.format),
             tex->microtile,
             tex->macrotile);
 
-    if (!tex->buffer) {
-        FREE(tex);
-        return NULL;
-    }
-
     return (struct pipe_resource*)tex;
 }