It seems that running valgrind when using cpputest library causes memory leaks errors. I use CLion + WSL (GCC + Valgrind). Every line containing TEST() macro is listed in leaks raport.
error: Failure in TEST(UT_Iterator, NullCases)
Memory leak(s) found.
Alloc num (5) Leak size: 48 Allocated at: /mnt/c/CLionProjects/spi-emulator/unit_test/IteratorTests.cpp and line: 14. Type: "new"
Memory: <0x4daa520> Content:
0000: 30 02 14 00 00 00 00 00 00 00 00 00 00 00 00 00 |0...............|
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
Total number of leaks: 1
I don't think they are real leaks (do they?). When you expand macro you can see something similar to:
virtual Utest *createTest() override {
return new(
"_file_name_", 14)TEST_UT_Iterator_NullCases_Test;
}