diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2022-01-08 22:52:55 +0300 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2022-02-02 21:06:12 +0300 |
commit | d2b36b7bd1847ff9e3748bff5edbbf9b2ea8a71a (patch) | |
tree | 7c8562508b884a820eec5f8f876ae5fa79498431 | |
parent | c35d14ecfaf785cbf557c6106372ea68e0b8011e (diff) |
xdg-shell: fix potential use-after-free
-rw-r--r-- | types/xdg_shell/wlr_xdg_popup.c | 1 | ||||
-rw-r--r-- | types/xdg_shell/wlr_xdg_toplevel.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c index 17b71cd4..6f887fca 100644 --- a/types/xdg_shell/wlr_xdg_popup.c +++ b/types/xdg_shell/wlr_xdg_popup.c @@ -331,6 +331,7 @@ void create_xdg_popup(struct wlr_xdg_surface *surface, wl_resource_get_version(surface->resource), id); if (surface->popup->resource == NULL) { free(surface->popup); + surface->popup = NULL; wl_resource_post_no_memory(surface->resource); return; } diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c index 8bbec935..ed7ecadd 100644 --- a/types/xdg_shell/wlr_xdg_toplevel.c +++ b/types/xdg_shell/wlr_xdg_toplevel.c @@ -475,6 +475,7 @@ void create_xdg_toplevel(struct wlr_xdg_surface *surface, wl_resource_get_version(surface->resource), id); if (surface->toplevel->resource == NULL) { free(surface->toplevel); + surface->toplevel = NULL; wl_resource_post_no_memory(surface->resource); return; } |