From 20bdc66ad2d51ecf3541ee0760c8a353e9a98db4 Mon Sep 17 00:00:00 2001 From: Johannes4433 Date: Thu, 20 Feb 2025 21:07:11 +0100 Subject: [PATCH] Fix memory leak when both -drun-categories and -drun-exclude-categories are used --- source/modes/drun.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/modes/drun.c b/source/modes/drun.c index 7de5ff9e..4b146fb9 100644 --- a/source/modes/drun.c +++ b/source/modes/drun.c @@ -724,8 +724,10 @@ static void read_desktop_file(DRunModePrivateData *pd, const char *root, } if (pd->exclude_categories) { - categories = g_key_file_get_locale_string_list( - kf, DRUN_GROUP_NAME, "Categories", NULL, NULL, NULL); + if (categories == NULL) { + categories = g_key_file_get_locale_string_list( + kf, DRUN_GROUP_NAME, "Categories", NULL, NULL, NULL); + } if (rofi_strv_contains((const char *const *)categories, (const char *const *)pd->exclude_categories)) { g_strfreev(categories);