test-ndef-build.c was not freeing the ndef records it got leading to memory leaks. Report by valgrind: (24 direct, 15 indirect) bytes in 1 blocks are definitely lost in loss record 24 of 38 at 0x483ED99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x11C176: ndef_message_alloc_complete.constprop.0 (ndef.c:1654) by 0x11FEC5: ndef_message_alloc (ndef.c:1760) by 0x11FEC5: near_ndef_prepare_text_record (ndef.c:3142) by 0x121676: test_ndef_text_build (test-ndef-build.c:63) by 0x48ECDCD: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6600.1) by 0x48ECBCA: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6600.1) by 0x48ED2B9: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6600.1) by 0x48ED2D4: g_test_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6600.1) by 0x10F5A1: main (test-ndef-build.c:113) Signed-off-by: Krzysztof Kozlowski --- unit/test-ndef-build.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/unit/test-ndef-build.c b/unit/test-ndef-build.c index 44dce4bf9aef..54b502f4a40b 100644 --- a/unit/test-ndef-build.c +++ b/unit/test-ndef-build.c @@ -65,6 +65,8 @@ static void test_ndef_text_build(void) g_assert(ndef); g_assert_cmpuint(ndef->length, ==, ARRAY_SIZE(text)); g_assert_cmpmem(ndef->data, ARRAY_SIZE(text), text, ARRAY_SIZE(text)); + + near_ndef_msg_free(ndef); } static void test_ndef_wsc_with_passphrase_build(void) @@ -76,6 +78,8 @@ static void test_ndef_wsc_with_passphrase_build(void) g_assert(ndef); g_assert_cmpuint(ndef->length, ==, ARRAY_SIZE(wsc)); g_assert_cmpmem(ndef->data, ARRAY_SIZE(wsc), wsc, ARRAY_SIZE(wsc)); + + near_ndef_msg_free(ndef); } static void test_ndef_wsc_with_out_passphrase_build(void) @@ -87,6 +91,8 @@ static void test_ndef_wsc_with_out_passphrase_build(void) g_assert(ndef); g_assert_cmpuint(ndef->length, ==, ARRAY_SIZE(wsc_wo)); g_assert_cmpmem(ndef->data, ARRAY_SIZE(wsc_wo), wsc_wo, ARRAY_SIZE(wsc_wo)); + + near_ndef_msg_free(ndef); } static void test_ndef_wsc_with_out_ssid_build(void) -- 2.27.0 _______________________________________________ Linux-nfc mailing list -- linux-nfc@lists.01.org To unsubscribe send an email to linux-nfc-leave@lists.01.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s