aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2019-08-15 00:36:13 +0100
committerHarry Jeffery <harry@exec64.co.uk>2019-08-15 00:36:13 +0100
commit4db590c0d02bce840f6ff87031aeed6f24cc06d5 (patch)
tree8585c82d424d5209be1f27ce3fb1fab73707388a
parentd371c7ab49d5f88a93511cb8157ef5dbd05fbf3d (diff)
downloadimv-4db590c0d02bce840f6ff87031aeed6f24cc06d5.tar.gz
wl_window: Patch up possible memory leaks
-rw-r--r--src/wl_window.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/wl_window.c b/src/wl_window.c
index 635fd4f..b5aac22 100644
--- a/src/wl_window.c
+++ b/src/wl_window.c
@@ -655,10 +655,34 @@ static void shutdown_wayland(struct imv_window *window)
if (window->wl_keyboard) {
wl_keyboard_destroy(window->wl_keyboard);
}
- xdg_toplevel_destroy(window->wl_xdg_toplevel);
- xdg_surface_destroy(window->wl_xdg_surface);
+ if (window->wl_seat) {
+ wl_seat_destroy(window->wl_seat);
+ }
+ if (window->wl_xdg_toplevel) {
+ xdg_toplevel_destroy(window->wl_xdg_toplevel);
+ }
+ if (window->wl_xdg_surface) {
+ xdg_surface_destroy(window->wl_xdg_surface);
+ }
+ if (window->wl_xdg) {
+ xdg_wm_base_destroy(window->wl_xdg);
+ }
+ if (window->egl_window) {
+ wl_egl_window_destroy(window->egl_window);
+ }
eglTerminate(window->egl_display);
- wl_surface_destroy(window->wl_surface);
+ if (window->wl_surface) {
+ wl_surface_destroy(window->wl_surface);
+ }
+ if (window->wl_compositor) {
+ wl_compositor_destroy(window->wl_compositor);
+ }
+ if (window->wl_registry) {
+ wl_registry_destroy(window->wl_registry);
+ }
+ if (window->wl_display) {
+ wl_display_disconnect(window->wl_display);
+ }
}
struct imv_window *imv_window_create(int width, int height, const char *title)
@@ -673,6 +697,7 @@ struct imv_window *imv_window_create(int width, int height, const char *title)
void imv_window_free(struct imv_window *window)
{
+ free(window->keymap);
shutdown_wayland(window);
list_deep_free(window->wl_outputs);
free(window);