[Mesa-dev] [PATCH v1] mesa: Avoid read of uninitialized variable

Robert Foss robert.foss at collabora.com
Wed Mar 1 22:34:28 UTC 2017


The is_color_attachement variable is later read when handling two
separate error cases, where only one of the cases results in the
variable being initialized.

This can be avoided by giving the variable a safe default value.

Coverity-Id: 1398631
Signed-off-by: Robert Foss <robert.foss at collabora.com>
---
 src/mesa/main/fbobject.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index c8ec8e68a1..f73a009d62 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -3684,7 +3684,7 @@ _mesa_get_framebuffer_attachment_parameter(struct gl_context *ctx,
                                            GLint *params, const char *caller)
 {
    const struct gl_renderbuffer_attachment *att;
-   bool is_color_attachment;
+   bool is_color_attachment = false;
    GLenum err;
 
    /* The error code for an attachment type of GL_NONE differs between APIs.
-- 
2.11.0.453.g787f75f05



More information about the mesa-dev mailing list