summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-01-08 12:34:21 -0600
committerDudemanguy <random342@airmail.cc>2023-01-08 12:39:50 -0600
commite43393c4da0c72dd974cc5ff08952f7614b3958f (patch)
tree5f0149480ba65814076eefd50835ac0607a848f9 /video/out
parentc5af54eb35af3d321483d8483977c3ba2fc12bd8 (diff)
downloadmpv-e43393c4da0c72dd974cc5ff08952f7614b3958f.tar.bz2
mpv-e43393c4da0c72dd974cc5ff08952f7614b3958f.tar.xz
vo_wlshm: cleanup on failure
If failure occurs during preinit, vo_wlshm should goto an error and cleaup itself like the other VOs.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/vo_wlshm.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/video/out/vo_wlshm.c b/video/out/vo_wlshm.c
index fc9fc705fc..e3e6f647a0 100644
--- a/video/out/vo_wlshm.c
+++ b/video/out/vo_wlshm.c
@@ -128,22 +128,38 @@ error0:
return NULL;
}
+static void uninit(struct vo *vo)
+{
+ struct priv *p = vo->priv;
+ struct buffer *buf;
+
+ while (p->free_buffers) {
+ buf = p->free_buffers;
+ p->free_buffers = buf->next;
+ talloc_free(buf);
+ }
+ vo_wayland_uninit(vo);
+}
+
static int preinit(struct vo *vo)
{
struct priv *p = vo->priv;
if (!vo_wayland_init(vo))
- return -1;
+ goto err;
if (!vo->wl->shm) {
MP_FATAL(vo->wl, "Compositor doesn't support the %s protocol!\n",
wl_shm_interface.name);
- return -1;
+ goto err;
}
p->sws = mp_sws_alloc(vo);
p->sws->log = vo->log;
mp_sws_enable_cmdline_opts(p->sws, vo->global);
return 0;
+err:
+ uninit(vo);
+ return -1;
}
static int query_format(struct vo *vo, int format)
@@ -278,19 +294,6 @@ static void get_vsync(struct vo *vo, struct vo_vsync_info *info)
present_sync_get_info(wl->present, info);
}
-static void uninit(struct vo *vo)
-{
- struct priv *p = vo->priv;
- struct buffer *buf;
-
- while (p->free_buffers) {
- buf = p->free_buffers;
- p->free_buffers = buf->next;
- talloc_free(buf);
- }
- vo_wayland_uninit(vo);
-}
-
const struct vo_driver video_out_wlshm = {
.description = "Wayland SHM video output (software scaling)",
.name = "wlshm",