From 64cfe746ab9a0158d18e7a3d5eedca3d94e80fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Wed, 7 Aug 2019 16:04:36 +0200 Subject: [PATCH] Fix memory leaks --- sway/commands/bar/tray_bind.c | 1 + swaybar/tray/icon.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sway/commands/bar/tray_bind.c b/sway/commands/bar/tray_bind.c index c910d1065..243834bad 100644 --- a/sway/commands/bar/tray_bind.c +++ b/sway/commands/bar/tray_bind.c @@ -52,6 +52,7 @@ static struct cmd_results *tray_bind(int argc, char **argv, bool code) { } } if (!binding->command) { + free(binding); return cmd_results_new(CMD_INVALID, "[Bar %s] Invalid tray command %s", config->current_bar->id, argv[1]); } diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c index c7e7f6bc3..429bea363 100644 --- a/swaybar/tray/icon.c +++ b/swaybar/tray/icon.c @@ -207,6 +207,7 @@ static struct icon_theme *read_theme_file(char *basedir, char *theme_name) { struct icon_theme *theme = calloc(1, sizeof(struct icon_theme)); if (!theme) { + fclose(theme_file); return NULL; } theme->subdirs = create_list();