svga: avoid a calloc in svga_buffer_transfer_map()
authorBrian Paul <brianp@vmware.com>
Tue, 2 Aug 2016 20:30:41 +0000 (14:30 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 16 Aug 2016 14:24:53 +0000 (08:24 -0600)
Just initialize the two other pipe_transfer fields explicitly.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
src/gallium/drivers/svga/svga_resource_buffer.c

index c126ff91c9080b9842836d8b19b551546fcd7c15..94788e70e318cb6ce144fb142fbdf9920d86ae03 100644 (file)
@@ -84,7 +84,7 @@ svga_buffer_transfer_map(struct pipe_context *pipe,
    assert(box->height == 1);
    assert(box->depth == 1);
 
-   transfer = CALLOC_STRUCT(pipe_transfer);
+   transfer = MALLOC_STRUCT(pipe_transfer);
    if (!transfer) {
       return NULL;
    }
@@ -93,6 +93,8 @@ svga_buffer_transfer_map(struct pipe_context *pipe,
    transfer->level = level;
    transfer->usage = usage;
    transfer->box = *box;
+   transfer->stride = 0;
+   transfer->layer_stride = 0;
 
    if ((usage & PIPE_TRANSFER_READ) && sbuf->dirty) {
       enum pipe_error ret;