[vlc-devel] [PATCH] wayland: shm: fix uninitialized variable before use

Alexandre Janniaux ajanni at videolabs.io
Mon Oct 28 14:21:24 CET 2019


In case of error, the registry variable is clobbered by the goto from
error handling and is freed without a correct value.
---
 modules/video_output/wayland/shm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index 9e22ff549f6..77acabdd0c2 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -287,13 +287,13 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     assert(sys->embed != NULL);

     struct wl_display *display = sys->embed->display.wl;
+    struct vlc_wl_registry *registry = NULL;

     sys->eventq = wl_display_create_queue(display);
     if (sys->eventq == NULL)
         goto error;

-    struct vlc_wl_registry *registry = vlc_wl_registry_get(display,
-                                                           sys->eventq);
+    registry = vlc_wl_registry_get(display, sys->eventq);
     if (registry == NULL)
         goto error;

--
2.23.0


More information about the vlc-devel mailing list