mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 17:10:21 +01:00
glib-aux/tests: avoid valgrind leak with nmtst_add_test_func()
When only running a subset of the tests (with "-p"), then valgrind
indicates a leak. Avoid that.
$ ./tools/run-nm-test.sh -m src/core/platform/tests/test-route-linux -v
# no leak
$ ./tools/run-nm-test.sh -m src/core/platform/tests/test-route-linux -v -p /route/ip4
# many leaks:
==1662102== 107 (96 direct, 11 indirect) bytes in 1 blocks are definitely lost in loss record 388 of 448
==1662102== at 0x4848464: calloc (vg_replace_malloc.c:1340)
==1662102== by 0x4F615F0: g_malloc0 (gmem.c:163)
==1662102== by 0x1621A6: _nmtst_add_test_func_full (nm-test-utils.h:918)
==1662102== by 0x1623EB: _nmtstp_setup_tests (test-route.c:2179)
==1662102== by 0x16E53D: main (test-common.c:2693)
==1662102==
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:calloc
fun:g_malloc0
fun:_nmtst_add_test_func_full
fun:_nmtstp_setup_tests
fun:main
}
This commit is contained in:
parent
43860e2b74
commit
f1874e6790
1 changed files with 5 additions and 1 deletions
|
|
@ -957,7 +957,11 @@ _nmtst_add_test_func_full(const char *testpath,
|
|||
|
||||
memcpy((char *) data->testpath, testpath, testpath_len);
|
||||
|
||||
g_test_add_data_func_full(testpath, data, _nmtst_test_run, g_free);
|
||||
_nmtst_testdata_track_add(data, g_free);
|
||||
g_test_add_data_func_full(testpath,
|
||||
data,
|
||||
_nmtst_test_run,
|
||||
_nmtst_testdata_track_steal_and_free);
|
||||
}
|
||||
|
||||
#define nmtst_add_test_func_full(testpath, func_test, func_setup, func_teardown, ...) \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue