aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/foreign-toplevel.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/foreign-toplevel.c b/examples/foreign-toplevel.c
index 820fc07b..2d16f77b 100644
--- a/examples/foreign-toplevel.c
+++ b/examples/foreign-toplevel.c
@@ -128,6 +128,11 @@ static void print_toplevel_state(struct toplevel_v1 *toplevel, bool print_endl)
}
}
+static void finish_toplevel_state(struct toplevel_state *state) {
+ free(state->title);
+ free(state->app_id);
+}
+
static void toplevel_handle_title(void *data,
struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel,
const char *title) {
@@ -228,6 +233,9 @@ static void toplevel_handle_closed(void *data,
printf(" closed\n");
zwlr_foreign_toplevel_handle_v1_destroy(zwlr_toplevel);
+ finish_toplevel_state(&toplevel->current);
+ finish_toplevel_state(&toplevel->pending);
+ free(toplevel);
}
static const struct zwlr_foreign_toplevel_handle_v1_listener toplevel_impl = {