[Mesa-dev] [PATCH] mesa: fix incorrect type when allocating arrays
Andres Rodriguez
andresx7 at gmail.com
Wed Feb 7 19:46:38 UTC 2018
The array members are have type 'struct gl_buffer_object *'
Found by coverity.
Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
---
I think this should fix the issue, if I'm interpreting
the coverity message correctly.
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
@@ -719,52 +719,52 @@ _mesa_WaitSemaphoreEXT(GLuint semaphore,
struct gl_semaphore_object *semObj = NULL;
struct gl_buffer_object **bufObjs = NULL;
struct gl_texture_object **texObjs = NULL;
const char *func = "glWaitSemaphoreEXT";
if (!ctx->Extensions.EXT_semaphore) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
return;
}
ASSERT_OUTSIDE_BEGIN_END(ctx);
semObj = _mesa_lookup_semaphore_object(ctx, semaphore);
if (!semObj)
return;
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);
goto end;
}
for (unsigned i = 0; i < numBufferBarriers; i++) {
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);
goto end;
}
for (unsigned i = 0; i < numTextureBarriers; i++) {
texObjs[i] = _mesa_lookup_texture(ctx, textures[i]);
}
ctx->Driver.ServerWaitSemaphoreObject(ctx, semObj,
numBufferBarriers, bufObjs,
numTextureBarriers, texObjs,
srcLayouts);
end:
free(bufObjs);
free(texObjs);
}
@@ -780,52 +780,52 @@ _mesa_SignalSemaphoreEXT(GLuint semaphore,
struct gl_semaphore_object *semObj = NULL;
struct gl_buffer_object **bufObjs = NULL;
struct gl_texture_object **texObjs = NULL;
const char *func = "glSignalSemaphoreEXT";
if (!ctx->Extensions.EXT_semaphore) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
return;
}
ASSERT_OUTSIDE_BEGIN_END(ctx);
semObj = _mesa_lookup_semaphore_object(ctx, semaphore);
if (!semObj)
return;
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);
goto end;
}
for (unsigned i = 0; i < numBufferBarriers; i++) {
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);
goto end;
}
for (unsigned i = 0; i < numTextureBarriers; i++) {
texObjs[i] = _mesa_lookup_texture(ctx, textures[i]);
}
ctx->Driver.ServerSignalSemaphoreObject(ctx, semObj,
numBufferBarriers, bufObjs,
numTextureBarriers, texObjs,
dstLayouts);
end:
free(bufObjs);
free(texObjs);
}
--
2.14.1
More information about the mesa-dev
mailing list