From dde64d88b7463d4f47ffcae317765c24b2bd708f Mon Sep 17 00:00:00 2001 From: rbuj Date: Fri, 22 Oct 2021 14:44:46 +0200 Subject: common: fix memory leak detected by scan-build --- capplets/common/mate-theme-info.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/capplets/common/mate-theme-info.c b/capplets/common/mate-theme-info.c index 6971602e..c8eca7f0 100644 --- a/capplets/common/mate-theme-info.c +++ b/capplets/common/mate-theme-info.c @@ -1215,11 +1215,14 @@ real_add_top_theme_dir_monitor (GFile *uri, tuple->priority = priority; /* Monitor the top directory */ - monitor = g_file_monitor_directory (uri, G_FILE_MONITOR_NONE, NULL, NULL); - if (monitor != NULL) { + if ((monitor = g_file_monitor_directory (uri, G_FILE_MONITOR_NONE, NULL, NULL)) != NULL) { g_signal_connect (monitor, "changed", (GCallback) (icon_theme ? top_icon_theme_dir_changed : top_theme_dir_changed), tuple); + } else { + g_hash_table_destroy (tuple->handle_hash); + g_free (tuple); + return FALSE; } /* Go through the directory to add monitoring */ -- cgit v1.2.1