From 4018ff1722a29ba0b1d5e21db7c2a2b964432afb Mon Sep 17 00:00:00 2001 From: Richard Cohen Date: Thu, 8 Jun 2023 16:24:37 +0100 Subject: [PATCH] Valgrind: fix "Mismatched free/delete" - test-kvp-frames etc. - test-kvp-frames - test-xml-account - test-xml-transaction - test-account-object - test-group-vs-book - test-lots - test-query - test-import-pending-matches ==30223== Mismatched free() / delete / delete [] ==30223== at 0x4846AFF: operator delete(void*, unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==30223== by 0x4E370AA: guid_free (guid.cpp:116) ... ==30223== Address 0x7ea4390 is 0 bytes inside a block of size 16 alloc'd ==30223== at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==30223== by 0x5032948: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1) ==30223== by 0x11603A: get_random_guid (test-engine-stuff.cpp:209) ... --- libgnucash/engine/test-core/test-engine-stuff.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libgnucash/engine/test-core/test-engine-stuff.cpp b/libgnucash/engine/test-core/test-engine-stuff.cpp index 05a2528e33..ce571916a1 100644 --- a/libgnucash/engine/test-core/test-engine-stuff.cpp +++ b/libgnucash/engine/test-core/test-engine-stuff.cpp @@ -204,12 +204,7 @@ get_random_time (void) GncGUID* get_random_guid(void) { - GncGUID *ret; - - ret = g_new(GncGUID, 1); - guid_replace(ret); - - return ret; + return guid_new(); } /* ========================================================== */