mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Valgrind: fix "definitely lost" memory from get_random_string() - test-address
==88262== 6 bytes in 1 blocks are definitely lost in loss record 5 of 2,117 ==88262== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==88262== by 0x503C550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1) ==88262== by 0x10B043: get_random_string_without (test-stuff.c:312) ==88262== by 0x10B0C0: get_random_string (test-stuff.c:333) ==88262== by 0x10A6E0: test_string_fcn (test-address.c:79) ==88262== by 0x10A694: test_address (test-address.c:69) ==88262== by 0x10A7C5: main (test-address.c:94) + 7 more
This commit is contained in:
@@ -76,12 +76,13 @@ test_string_fcn (GncAddress *address, const char *message,
|
||||
void (*set) (GncAddress *, const char *str),
|
||||
const char * (*get)(const GncAddress *))
|
||||
{
|
||||
char const *str = get_random_string ();
|
||||
char *str = get_random_string ();
|
||||
|
||||
do_test (!gncAddressIsDirty (address), "test if start dirty");
|
||||
set (address, str);
|
||||
do_test (gncAddressIsDirty (address), "test dirty later");
|
||||
do_test (g_strcmp0 (get (address), str) == 0, message);
|
||||
g_free (str);
|
||||
gncAddressClearDirty (address);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user