From d808fddc956909a27be08d728e6c2cfc8daa5253 Mon Sep 17 00:00:00 2001 From: Richard Cohen Date: Thu, 6 Jul 2023 16:11:29 +0100 Subject: [PATCH] Valgrind: fix "definitely lost" memory in test - test-userdata-dir-invalid-home ==66427== 128 bytes in 1 blocks are definitely lost in loss record 22 of 25 ==66427== at 0x4843738: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==66427== by 0x49B85EF: g_realloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1) ==66427== by 0x49D6EF1: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1) ==66427== by 0x49D6F6F: g_string_sized_new (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1) ==66427== by 0x499AB00: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1) ==66427== by 0x499B2D8: g_build_filename (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1) ==66427== by 0x10A498: main (test-userdata-dir-invalid-home.c:74) ==66427== --- libgnucash/core-utils/test/test-userdata-dir-invalid-home.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libgnucash/core-utils/test/test-userdata-dir-invalid-home.c b/libgnucash/core-utils/test/test-userdata-dir-invalid-home.c index b81d521333..3ec1e98946 100644 --- a/libgnucash/core-utils/test/test-userdata-dir-invalid-home.c +++ b/libgnucash/core-utils/test/test-userdata-dir-invalid-home.c @@ -83,6 +83,8 @@ main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) * The code should fall back to using the temporary * directory in that case. */ g_setenv("HOME", homedir, TRUE); + g_free (homedir); + for (i = 0; strs2[i].funcname != NULL; i++) { char *daout;