summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy911 <random342@airmail.cc>2019-10-02 18:38:45 -0500
committerDudemanguy911 <random342@airmail.cc>2019-10-02 18:38:45 -0500
commitdefc8f359c5e4bb666e8ad1d4a097a8ac66cc1e2 (patch)
tree579decb0539ead0dbab01ca2f418d42f9c7b528e
parentc669a434f3cb720868ed9aaf4af8d9fddb203d64 (diff)
downloadmpv-defc8f359c5e4bb666e8ad1d4a097a8ac66cc1e2.tar.bz2
mpv-defc8f359c5e4bb666e8ad1d4a097a8ac66cc1e2.tar.xz
wayland: free wayland_state on a false return
wm4 mentioned that the wayland autoprobe leaked. A simple oversight in the wayland_common code forgot to free the vo_wayland_state if vo_wayland_init returned false.
-rw-r--r--video/out/wayland_common.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index a70377f3c6..d015bb4882 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -1043,11 +1043,15 @@ int vo_wayland_init(struct vo *vo)
wl_list_init(&wl->output_list);
- if (!wl->display)
+ if (!wl->display) {
+ talloc_free(wl);
return false;
+ }
- if (create_input(wl))
+ if (create_input(wl)) {
+ talloc_free(wl);
return false;
+ }
wl->registry = wl_display_get_registry(wl->display);
wl_registry_add_listener(wl->registry, &registry_listener, wl);
@@ -1058,18 +1062,22 @@ int vo_wayland_init(struct vo *vo)
if (!wl->wm_base) {
MP_FATAL(wl, "Compositor doesn't support the required %s protocol!\n",
xdg_wm_base_interface.name);
+ talloc_free(wl);
return false;
}
if (!wl_list_length(&wl->output_list)) {
MP_FATAL(wl, "No outputs found or compositor doesn't support %s (ver. 2)\n",
wl_output_interface.name);
+ talloc_free(wl);
return false;
}
/* Can't be initialized during registry due to multi-protocol dependence */
- if (create_xdg_surface(wl))
+ if (create_xdg_surface(wl)) {
+ talloc_free(wl);
return false;
+ }
if (wl->dnd_devman) {
wl->dnd_ddev = wl_data_device_manager_get_data_device(wl->dnd_devman, wl->seat);