]> git.mdlowis.com Git - proto/labwc.git/commitdiff
fix cleanup issues in xdg_surface_new
authorbi4k8 <bi4k8@github>
Thu, 8 Dec 2022 05:27:25 +0000 (05:27 +0000)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 8 Dec 2022 19:24:02 +0000 (19:24 +0000)
`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.

src/xdg.c

index edfdabbf0c12b60e9bc98b6782963b04a1fd5db5..6ae53993f1a34484b0fc869b80890e0beceff77b 100644 (file)
--- 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;