Mesa (master): mesa: Avoid read of uninitialized variable

Emil Velikov evelikov at kemper.freedesktop.org
Thu Mar 2 15:49:39 UTC 2017


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

Author: Robert Foss <robert.foss at collabora.com>
Date:   Wed Mar  1 19:14:39 2017 -0500

mesa: Avoid read of uninitialized variable

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
Cc: mesa-stable at lists.freedesktop.org
Signed-off-by: Robert Foss <robert.foss at collabora.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Emil Velikov <emil.velikov 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 c8ec8e6..f73a009 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.




More information about the mesa-commit mailing list