Mesa (master): svga: avoid a calloc in svga_buffer_transfer_map()

Brian Paul brianp at kemper.freedesktop.org
Tue Aug 16 14:29:09 UTC 2016


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

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Aug  2 14:30:41 2016 -0600

svga: avoid a calloc in svga_buffer_transfer_map()

Just initialize the two other pipe_transfer fields explicitly.

Reviewed-by: Charmaine Lee <charmainel at vmware.com>

---

 src/gallium/drivers/svga/svga_resource_buffer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c
index c126ff9..94788e7 100644
--- a/src/gallium/drivers/svga/svga_resource_buffer.c
+++ b/src/gallium/drivers/svga/svga_resource_buffer.c
@@ -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;




More information about the mesa-commit mailing list