From d83431335da858d1b03380e5ad90d42c287abf69 Mon Sep 17 00:00:00 2001 From: columbarius Date: Thu, 15 Apr 2021 02:29:41 +0200 Subject: [PATCH] wlr_screencast: create clean xdpw_wlr_output and free on remove --- src/screencast/wlr_screencast.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/screencast/wlr_screencast.c b/src/screencast/wlr_screencast.c index dc8e3da..a4ec1ea 100644 --- a/src/screencast/wlr_screencast.c +++ b/src/screencast/wlr_screencast.c @@ -543,7 +543,13 @@ struct xdpw_wlr_output *xdpw_wlr_output_find(struct xdpw_screencast_context *ctx } static void wlr_remove_output(struct xdpw_wlr_output *out) { + free(out->name); + free(out->make); + free(out->model); + zxdg_output_v1_destroy(out->xdg_output); + wl_output_destroy(out->output); wl_list_remove(&out->link); + free(out); } static void wlr_registry_handle_add(void *data, struct wl_registry *reg, @@ -552,7 +558,7 @@ static void wlr_registry_handle_add(void *data, struct wl_registry *reg, logprint(DEBUG, "wlroots: interface to register %s (Version: %u)",interface, ver); if (!strcmp(interface, wl_output_interface.name)) { - struct xdpw_wlr_output *output = malloc(sizeof(*output)); + struct xdpw_wlr_output *output = calloc(1, sizeof(*output)); output->id = id; logprint(DEBUG, "wlroots: |-- registered to interface %s (Version %u)", interface, WL_OUTPUT_VERSION);