mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-25 18:30:23 -06:00
Valgrind: fix "definitely lost" memory from get_random_string() - test-vendor
==88804== 8 bytes in 1 blocks are definitely lost in loss record 12 of 479 ==88804== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==88804== by 0x503C550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1) ==88804== by 0x10B5D8: get_random_string_without (test-stuff.c:312) ==88804== by 0x10B655: get_random_string (test-stuff.c:333) ==88804== by 0x10AA92: test_string_fcn (test-vendor.c:138) ==88804== by 0x10A76B: test_vendor (test-vendor.c:88) ==88804== by 0x10AD5A: main (test-vendor.c:246) + 3 more
This commit is contained in:
parent
30b47d1669
commit
a36844720d
@ -117,13 +117,13 @@ test_vendor (void)
|
||||
g_list_free (list);
|
||||
}
|
||||
{
|
||||
const char *str = get_random_string();
|
||||
const char *res;
|
||||
char *str = get_random_string();
|
||||
|
||||
gncVendorSetName (vendor, str);
|
||||
res = qof_object_printable (GNC_ID_VENDOR, vendor);
|
||||
const char *res = qof_object_printable (GNC_ID_VENDOR, vendor);
|
||||
do_test (res != NULL, "Printable NULL?");
|
||||
do_test (g_strcmp0 (str, res) == 0, "Printable equals");
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
qof_book_destroy (book);
|
||||
@ -135,7 +135,7 @@ test_string_fcn (QofBook *book, const char *message,
|
||||
const char * (*get)(const GncVendor *))
|
||||
{
|
||||
GncVendor *vendor = gncVendorCreate (book);
|
||||
char const *str = get_random_string ();
|
||||
char *str = get_random_string ();
|
||||
|
||||
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
|
||||
gncVendorBeginEdit (vendor);
|
||||
@ -150,6 +150,7 @@ test_string_fcn (QofBook *book, const char *message,
|
||||
*/
|
||||
// do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
|
||||
do_test (g_strcmp0 (get (vendor), str) == 0, message);
|
||||
g_free (str);
|
||||
gncVendorSetActive (vendor, FALSE);
|
||||
count++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user