Mesa (master): mesa: fix incorrect type when allocating arrays

Andres Rodriguez lostgoat at kemper.freedesktop.org
Wed Feb 7 19:50:52 UTC 2018


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

Author: Andres Rodriguez <andresx7 at gmail.com>
Date:   Wed Feb  7 14:38:52 2018 -0500

mesa: fix incorrect type when allocating arrays

The array members are have type 'struct gl_buffer_object *'

Found by coverity.

Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/main/externalobjects.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index 35545c2e55..56bf817a6e 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -736,7 +736,7 @@ _mesa_WaitSemaphoreEXT(GLuint semaphore,
    FLUSH_VERTICES(ctx, 0);
    FLUSH_CURRENT(ctx, 0);
 
-   bufObjs = malloc(sizeof(struct gl_buffer_object **) * numBufferBarriers);
+   bufObjs = malloc(sizeof(struct gl_buffer_object *) * numBufferBarriers);
    if (!bufObjs) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s(numBufferBarriers=%u)",
                   func, numBufferBarriers);
@@ -747,7 +747,7 @@ _mesa_WaitSemaphoreEXT(GLuint semaphore,
       bufObjs[i] = _mesa_lookup_bufferobj(ctx, buffers[i]);
    }
 
-   texObjs = malloc(sizeof(struct gl_texture_object **) * numTextureBarriers);
+   texObjs = malloc(sizeof(struct gl_texture_object *) * numTextureBarriers);
    if (!texObjs) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s(numTextureBarriers=%u)",
                   func, numTextureBarriers);
@@ -797,7 +797,7 @@ _mesa_SignalSemaphoreEXT(GLuint semaphore,
    FLUSH_VERTICES(ctx, 0);
    FLUSH_CURRENT(ctx, 0);
 
-   bufObjs = malloc(sizeof(struct gl_buffer_object **) * numBufferBarriers);
+   bufObjs = malloc(sizeof(struct gl_buffer_object *) * numBufferBarriers);
    if (!bufObjs) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s(numBufferBarriers=%u)",
                   func, numBufferBarriers);
@@ -808,7 +808,7 @@ _mesa_SignalSemaphoreEXT(GLuint semaphore,
       bufObjs[i] = _mesa_lookup_bufferobj(ctx, buffers[i]);
    }
 
-   texObjs = malloc(sizeof(struct gl_texture_object **) * numTextureBarriers);
+   texObjs = malloc(sizeof(struct gl_texture_object *) * numTextureBarriers);
    if (!texObjs) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s(numTextureBarriers=%u)",
                   func, numTextureBarriers);




More information about the mesa-commit mailing list