Mesa (master): vl: Silence a warning at -Og

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 18 21:15:30 UTC 2021


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

Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jan 26 14:17:52 2021 -0500

vl: Silence a warning at -Og

   ../src/gallium/auxiliary/vl/vl_winsys_dri.c: In function ‘vl_dri2_screen_texture_from_drawable’:
   ../src/gallium/auxiliary/vl/vl_winsys_dri.c:239:34: warning: ‘back_left’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     239 |    dri2_handle.stride = back_left->pitch;

The server would be broken if it failed to inform us of the back left
buffer, but let's leave nothing to chance.

Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

---

 src/gallium/auxiliary/vl/vl_winsys_dri.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index 1f160ec9758..091395d27f3 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -186,7 +186,7 @@ vl_dri2_screen_texture_from_drawable(struct vl_screen *vscreen, void *drawable)
    struct pipe_resource templ, *tex;
 
    xcb_dri2_get_buffers_reply_t *reply;
-   xcb_dri2_dri2_buffer_t *buffers, *back_left;
+   xcb_dri2_dri2_buffer_t *buffers, *back_left = NULL;
 
    unsigned depth = ((xcb_screen_t *)(vscreen->xcb_screen))->root_depth;
    unsigned i;
@@ -217,7 +217,7 @@ vl_dri2_screen_texture_from_drawable(struct vl_screen *vscreen, void *drawable)
       }
    }
 
-   if (i == reply->count) {
+   if (i == reply->count || !back_left) {
       free(reply);
       return NULL;
    }



More information about the mesa-commit mailing list