Skip to content

Commit

Permalink
Valgrind: fix "Mismatched free/delete" - test-scm-query etc.
Browse files Browse the repository at this point in the history
- test-scm-query
- test-print-queries
- test-scm-query-string

==14597== Mismatched free() / delete / delete []
==14597==    at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==14597==    by 0x118851: free_random_guids(_GList*) (test-engine-stuff.cpp:1505)
==14597==    by 0x118CF5: get_random_query (test-engine-stuff.cpp:1674)
...
==14597==  Address 0xa1366a0 is 0 bytes inside a block of size 16 alloc'd
==14597==    at 0x4843FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==14597==    by 0x5342FA6: guid_malloc (guid.cpp:106)
==14597==    by 0x534300D: guid_copy (guid.cpp:123)
==14597==    by 0x534311F: guid_new (guid.cpp:154)
==14597==    by 0x115D1A: get_random_guid (test-engine-stuff.cpp:207)
==14597==    by 0x1187FA: get_random_guids(int) (test-engine-stuff.cpp:1494)
==14597==    by 0x118CC0: get_random_query (test-engine-stuff.cpp:1668)
...

==15045== Mismatched free() / delete / delete []
==15045==    at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==15045==    by 0x118E96: get_random_query (test-engine-stuff.cpp:1735)
...
==15045==  Address 0xa077d40 is 0 bytes inside a block of size 16 alloc'd
==15045==    at 0x4843FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==15045==    by 0x5342FA6: guid_malloc (guid.cpp:106)
==15045==    by 0x534300D: guid_copy (guid.cpp:123)
==15045==    by 0x534311F: guid_new (guid.cpp:154)
==15045==    by 0x115D1A: get_random_guid (test-engine-stuff.cpp:207)
==15045==    by 0x118E65: get_random_query (test-engine-stuff.cpp:1730)
...
  • Loading branch information
richardcohen committed Jun 21, 2023
1 parent 2e861ab commit f1a3f2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libgnucash/engine/test-core/test-engine-stuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,7 @@ free_random_guids(GList *guids)
GList *node;

for (node = guids; node; node = node->next)
g_free (node->data);
guid_free (static_cast<GncGUID*>(node->data));

g_list_free (guids);
}
Expand Down Expand Up @@ -1732,7 +1732,7 @@ get_random_query(void)
guid,
get_random_id_type (),
get_random_queryop ());
g_free (guid);
guid_free (guid);
break;

case 8: /* PR_KVP */
Expand Down

0 comments on commit f1a3f2a

Please sign in to comment.