mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
xdg-shell: fix potential use-after-free
This commit is contained in:
parent
c35d14ecfa
commit
d2b36b7bd1
2 changed files with 2 additions and 0 deletions
|
@ -331,6 +331,7 @@ void create_xdg_popup(struct wlr_xdg_surface *surface,
|
||||||
wl_resource_get_version(surface->resource), id);
|
wl_resource_get_version(surface->resource), id);
|
||||||
if (surface->popup->resource == NULL) {
|
if (surface->popup->resource == NULL) {
|
||||||
free(surface->popup);
|
free(surface->popup);
|
||||||
|
surface->popup = NULL;
|
||||||
wl_resource_post_no_memory(surface->resource);
|
wl_resource_post_no_memory(surface->resource);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -475,6 +475,7 @@ void create_xdg_toplevel(struct wlr_xdg_surface *surface,
|
||||||
wl_resource_get_version(surface->resource), id);
|
wl_resource_get_version(surface->resource), id);
|
||||||
if (surface->toplevel->resource == NULL) {
|
if (surface->toplevel->resource == NULL) {
|
||||||
free(surface->toplevel);
|
free(surface->toplevel);
|
||||||
|
surface->toplevel = NULL;
|
||||||
wl_resource_post_no_memory(surface->resource);
|
wl_resource_post_no_memory(surface->resource);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue