From 9bf2ff4faf730913de3073f346646a8727be41d4 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Thu, 8 Oct 2009 13:36:44 +1100 Subject: [PATCH] Fix "possibly uninitialized" warnings in glx In both functions, "answer" was uninitialized if "compsize" was 0, but in that case __GLX_SEND_VOID_ARRAY(compsize) results in a call to WriteToClient for 0 bytes, which returns immediately without examining the "answer" argument. So initializing to a null pointer is as good as anything else. Signed-off-by: Jamey Sharp Signed-off-by: Daniel Stone --- glx/indirect_texture_compression.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glx/indirect_texture_compression.c b/glx/indirect_texture_compression.c index 25c6eb30e..5f44d7b1a 100644 --- a/glx/indirect_texture_compression.c +++ b/glx/indirect_texture_compression.c @@ -52,7 +52,7 @@ int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *p const GLenum target = *(GLenum *)(pc + 0); const GLint level = *(GLint *)(pc + 4); GLint compsize = 0; - char *answer, answerBuffer[200]; + char *answer = NULL, answerBuffer[200]; CALL_GetTexLevelParameteriv(GET_DISPATCH(), (target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize)); @@ -92,7 +92,7 @@ int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyt const GLenum target = (GLenum) bswap_32( *(int *)(pc + 0) ); const GLint level = (GLint ) bswap_32( *(int *)(pc + 4) ); GLint compsize = 0; - char *answer, answerBuffer[200]; + char *answer = NULL, answerBuffer[200]; CALL_GetTexLevelParameteriv(GET_DISPATCH(), (target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize));