From: bi4k8 Date: Thu, 8 Dec 2022 05:27:25 +0000 (+0000) Subject: fix cleanup issues in xdg_surface_new X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=272221dae23715d7c14cba46ac53819bb0fb2bd6;p=proto%2Flabwc.git fix cleanup issues in xdg_surface_new `view->surface` had not been set to a non-`NULL` value here, so it was not yet appropriate to access its `resource` member. instead, use the resource from the argument xdg_surface. furthermore, we need to free the newly-allocated `xdg_toplevel_view` before error return. --- diff --git a/src/xdg.c b/src/xdg.c index edfdabbf..6ae53993 100644 --- a/src/xdg.c +++ b/src/xdg.c @@ -420,7 +420,8 @@ xdg_surface_new(struct wl_listener *listener, void *data) view->scene_tree, xdg_surface); if (!tree) { /* TODO: might need further clean up */ - wl_resource_post_no_memory(view->surface->resource); + wl_resource_post_no_memory(xdg_surface->resource); + free(xdg_toplevel_view); return; } view->scene_node = &tree->node;