From 29943f53dd200fc1ff7af4627e866cb2bb6ae9ff Mon Sep 17 00:00:00 2001 From: Kate Hsuan Date: Tue, 26 May 2026 16:27:42 +0800 Subject: [PATCH] up-self-test: fix leak by freeing history_dir Global pointer 'history_dir' is allocated via g_build_filename() and modified in-place by mkdtemp(), but is never freed with g_free(). After rmdir(history_dir), the allocated string is leaked when the test returns through g_test_run(). Co-Authored-By: Claude Opus 4.6 Signed-off-by: Kate Hsuan --- src/up-self-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/up-self-test.c b/src/up-self-test.c index 5a4e3cb..69459a5 100644 --- a/src/up-self-test.c +++ b/src/up-self-test.c @@ -285,6 +285,8 @@ up_test_history_func (void) /* remove these test files */ up_test_history_remove_temp_files (); rmdir (history_dir); + g_free (history_dir); + history_dir = NULL; } static void