summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2022-06-24 11:41:33 +0100
committerDaniel Stone <daniels@collabora.com>2022-06-29 14:33:21 +0100
commitf9e54ab2f80ab1c3c3c1394e3885dd33dcd731a8 (patch)
treedf7bb99507ec5284b4f119bfb1357d3f34fce00c /clients
parent6bfbfb2e1021841cf261e4ccd82f9a328e96876c (diff)
downloadweston-f9e54ab2f80ab1c3c3c1394e3885dd33dcd731a8.tar.gz
weston-terminal: Fix some egregious memory leaks
Some of the Pango bits still leak, but this takes care of a lot of the worst. Signed-off-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'clients')
-rw-r--r--clients/terminal.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/clients/terminal.c b/clients/terminal.c
index b7537aad..b02d7d03 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -3023,13 +3023,19 @@ static void
terminal_destroy(struct terminal *terminal)
{
display_unwatch_fd(terminal->display, terminal->master);
- window_destroy(terminal->window);
close(terminal->master);
+
+ widget_destroy(terminal->widget);
+ window_destroy(terminal->window);
+
wl_list_remove(&terminal->link);
if (wl_list_empty(&terminal_list))
display_exit(terminal->display);
+ free(terminal->data);
+ free(terminal->data_attr);
+ free(terminal->tab_ruler);
free(terminal->title);
free(terminal);
}
@@ -3128,7 +3134,7 @@ static const struct weston_option terminal_options[] = {
int main(int argc, char *argv[])
{
struct display *d;
- struct terminal *terminal;
+ struct terminal *terminal, *tmp;
const char *config_file;
struct sigaction sigpipe;
struct weston_config *config;
@@ -3183,5 +3189,9 @@ int main(int argc, char *argv[])
display_run(d);
+ wl_list_for_each_safe(terminal, tmp, &terminal_list, link)
+ terminal_destroy(terminal);
+ display_destroy(d);
+
return 0;
}