Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remaining leaks in test_string_map.cpp #151

Merged
merged 1 commit into from
Apr 17, 2019

Conversation

thomas-moulard
Copy link
Contributor

This change prevents leaks in test_string_map by relying
on OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT to consisdently free
memory even if an exception is thrown.

This also adds a call to:
set_failing_allocator_is_failing(failing_allocator, true);
...before calling rcutils_string_map_fini() in the test cases
where a failling allocator is used.

Before this change, this was not always the case preventing
the memory from being actually freed.

Fixes #146

Signed-off-by: Thomas Moulard tmoulard@amazon.com

This change prevents leaks in test_string_map by relying
on OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT to consisdently free
memory even if an exception is thrown.

This also adds a call to:
    set_failing_allocator_is_failing(failing_allocator, true);
...before calling rcutils_string_map_fini() in the test cases
where a failling allocator is used.

Before this change, this was not always the case preventing
the memory from being actually freed.

Fixes ros2#146

Signed-off-by: Thomas Moulard <tmoulard@amazon.com>
@tfoote tfoote added the in progress Actively being worked on (Kanban column) label Apr 15, 2019
@thomas-moulard
Copy link
Contributor Author

Before:

Running main() from ../../../install-asan/gtest_vendor/src/gtest_vendor/src/gtest_main.cc
[==========] Running 17 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 12 tests from test_string_map
[ RUN      ] test_string_map.lifecycle
[       OK ] test_string_map.lifecycle (0 ms)
[ RUN      ] test_string_map.reserve_and_clear
[       OK ] test_string_map.reserve_and_clear (0 ms)
[ RUN      ] test_string_map.set_no_resize
[       OK ] test_string_map.set_no_resize (0 ms)
[ RUN      ] test_string_map.set
[       OK ] test_string_map.set (0 ms)
[ RUN      ] test_string_map.key_exists
[       OK ] test_string_map.key_exists (1 ms)
[ RUN      ] test_string_map.key_existsn
[       OK ] test_string_map.key_existsn (0 ms)
[ RUN      ] test_string_map.unset
[       OK ] test_string_map.unset (0 ms)
[ RUN      ] test_string_map.get
[       OK ] test_string_map.get (0 ms)
[ RUN      ] test_string_map.getn
[       OK ] test_string_map.getn (0 ms)
[ RUN      ] test_string_map.get_next_key
[       OK ] test_string_map.get_next_key (0 ms)
[ RUN      ] test_string_map.copy
[       OK ] test_string_map.copy (0 ms)
[ RUN      ] test_string_map.strange_keys
[       OK ] test_string_map.strange_keys (0 ms)
[----------] 12 tests from test_string_map (1 ms total)

[----------] 5 tests from TestStringMap
[ RUN      ] TestStringMap.getters_capacity_null_list
[       OK ] TestStringMap.getters_capacity_null_list (0 ms)
[ RUN      ] TestStringMap.getters_size_null_list
[       OK ] TestStringMap.getters_size_null_list (0 ms)
[ RUN      ] TestStringMap.getters_capacity_null_capacity
[       OK ] TestStringMap.getters_capacity_null_capacity (0 ms)
[ RUN      ] TestStringMap.getters_size_null_size
[       OK ] TestStringMap.getters_size_null_size (0 ms)
[ RUN      ] TestStringMap.getters_initialize_to_zero
[       OK ] TestStringMap.getters_initialize_to_zero (0 ms)
[----------] 5 tests from TestStringMap (0 ms total)

[----------] Global test environment tear-down
[==========] 17 tests from 2 test cases ran. (1 ms total)
[  PASSED  ] 17 tests.

=================================================================
==9776==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x7f1b031f8b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x7f1b02ef5bb5 in __default_allocate (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x8bb5)
    #2 0x55af95827a42 in failing_malloc (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x19a42)
    #3 0x7f1b02f081b0 in rcutils_string_map_init (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x1b1b0)
    #4 0x55af958449f2 in test_string_map_set_no_resize_Test::TestBody() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x369f2)
    #5 0x55af958fb4d3 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xed4d3)
    #6 0x55af958ed27b in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xdf27b)
    #7 0x55af9589906f in testing::Test::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8b06f)
    #8 0x55af9589a49a in testing::TestInfo::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8c49a)
    #9 0x55af9589b03e in testing::TestCase::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8d03e)
    #10 0x55af958b614f in testing::internal::UnitTestImpl::RunAllTests() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa814f)
    #11 0x55af958fdf86 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xeff86)
    #12 0x55af958ef544 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xe1544)
    #13 0x55af958b2ee3 in testing::UnitTest::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa4ee3)
    #14 0x55af95886432 in RUN_ALL_TESTS() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78432)
    #15 0x55af95886378 in main (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78378)
    #16 0x7f1b0235db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x7f1b031f8b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x7f1b02ef5bb5 in __default_allocate (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x8bb5)
    #2 0x55af95827a42 in failing_malloc (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x19a42)
    #3 0x7f1b02f081b0 in rcutils_string_map_init (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x1b1b0)
    #4 0x55af95852233 in test_string_map_set_Test::TestBody() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x44233)
    #5 0x55af958fb4d3 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xed4d3)
    #6 0x55af958ed27b in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xdf27b)
    #7 0x55af9589906f in testing::Test::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8b06f)
    #8 0x55af9589a49a in testing::TestInfo::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8c49a)
    #9 0x55af9589b03e in testing::TestCase::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8d03e)
    #10 0x55af958b614f in testing::internal::UnitTestImpl::RunAllTests() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa814f)
    #11 0x55af958fdf86 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xeff86)
    #12 0x55af958ef544 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xe1544)
    #13 0x55af958b2ee3 in testing::UnitTest::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa4ee3)
    #14 0x55af95886432 in RUN_ALL_TESTS() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78432)
    #15 0x55af95886378 in main (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78378)
    #16 0x7f1b0235db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7f1b031f8f40 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef40)
    #1 0x7f1b02ef5bfd in __default_reallocate (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x8bfd)
    #2 0x55af95827d26 in failing_realloc (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x19d26)
    #3 0x7f1b02f08e29 in rcutils_string_map_reserve (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x1be29)
    #4 0x7f1b02f08392 in rcutils_string_map_init (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x1b392)
    #5 0x55af95852233 in test_string_map_set_Test::TestBody() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x44233)
    #6 0x55af958fb4d3 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xed4d3)
    #7 0x55af958ed27b in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xdf27b)
    #8 0x55af9589906f in testing::Test::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8b06f)
    #9 0x55af9589a49a in testing::TestInfo::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8c49a)
    #10 0x55af9589b03e in testing::TestCase::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8d03e)
    #11 0x55af958b614f in testing::internal::UnitTestImpl::RunAllTests() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa814f)
    #12 0x55af958fdf86 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xeff86)
    #13 0x55af958ef544 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xe1544)
    #14 0x55af958b2ee3 in testing::UnitTest::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa4ee3)
    #15 0x55af95886432 in RUN_ALL_TESTS() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78432)
    #16 0x55af95886378 in main (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78378)
    #17 0x7f1b0235db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7f1b031f8f40 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef40)
    #1 0x7f1b02ef5bfd in __default_reallocate (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x8bfd)
    #2 0x55af95827d26 in failing_realloc (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x19d26)
    #3 0x7f1b02f08f03 in rcutils_string_map_reserve (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x1bf03)
    #4 0x7f1b02f08392 in rcutils_string_map_init (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x1b392)
    #5 0x55af95852233 in test_string_map_set_Test::TestBody() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x44233)
    #6 0x55af958fb4d3 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xed4d3)
    #7 0x55af958ed27b in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xdf27b)
    #8 0x55af9589906f in testing::Test::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8b06f)
    #9 0x55af9589a49a in testing::TestInfo::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8c49a)
    #10 0x55af9589b03e in testing::TestCase::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8d03e)
    #11 0x55af958b614f in testing::internal::UnitTestImpl::RunAllTests() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa814f)
    #12 0x55af958fdf86 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xeff86)
    #13 0x55af958ef544 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xe1544)
    #14 0x55af958b2ee3 in testing::UnitTest::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa4ee3)
    #15 0x55af95886432 in RUN_ALL_TESTS() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78432)
    #16 0x55af95886378 in main (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78378)
    #17 0x7f1b0235db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7f1b031f8f40 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef40)
    #1 0x7f1b02ef5bfd in __default_reallocate (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x8bfd)
    #2 0x55af95827d26 in failing_realloc (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x19d26)
    #3 0x7f1b02f08f03 in rcutils_string_map_reserve (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x1bf03)
    #4 0x7f1b02f08392 in rcutils_string_map_init (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x1b392)
    #5 0x55af958449f2 in test_string_map_set_no_resize_Test::TestBody() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x369f2)
    #6 0x55af958fb4d3 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xed4d3)
    #7 0x55af958ed27b in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xdf27b)
    #8 0x55af9589906f in testing::Test::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8b06f)
    #9 0x55af9589a49a in testing::TestInfo::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8c49a)
    #10 0x55af9589b03e in testing::TestCase::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8d03e)
    #11 0x55af958b614f in testing::internal::UnitTestImpl::RunAllTests() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa814f)
    #12 0x55af958fdf86 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xeff86)
    #13 0x55af958ef544 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xe1544)
    #14 0x55af958b2ee3 in testing::UnitTest::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa4ee3)
    #15 0x55af95886432 in RUN_ALL_TESTS() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78432)
    #16 0x55af95886378 in main (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78378)
    #17 0x7f1b0235db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7f1b031f8f40 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef40)
    #1 0x7f1b02ef5bfd in __default_reallocate (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x8bfd)
    #2 0x55af95827d26 in failing_realloc (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x19d26)
    #3 0x7f1b02f08e29 in rcutils_string_map_reserve (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x1be29)
    #4 0x7f1b02f08392 in rcutils_string_map_init (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install-asan/rcutils/lib/librcutils.so+0x1b392)
    #5 0x55af958449f2 in test_string_map_set_no_resize_Test::TestBody() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x369f2)
    #6 0x55af958fb4d3 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xed4d3)
    #7 0x55af958ed27b in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xdf27b)
    #8 0x55af9589906f in testing::Test::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8b06f)
    #9 0x55af9589a49a in testing::TestInfo::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8c49a)
    #10 0x55af9589b03e in testing::TestCase::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x8d03e)
    #11 0x55af958b614f in testing::internal::UnitTestImpl::RunAllTests() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa814f)
    #12 0x55af958fdf86 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xeff86)
    #13 0x55af958ef544 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xe1544)
    #14 0x55af958b2ee3 in testing::UnitTest::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0xa4ee3)
    #15 0x55af95886432 in RUN_ALL_TESTS() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78432)
    #16 0x55af95886378 in main (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_string_map+0x78378)
    #17 0x7f1b0235db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

SUMMARY: AddressSanitizer: 176 byte(s) leaked in 6 allocation(s).

After:

 ./test_string_map
Running main() from ../../../install-asan/gtest_vendor/src/gtest_vendor/src/gtest_main.cc
[==========] Running 17 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 12 tests from test_string_map
[ RUN      ] test_string_map.lifecycle
[       OK ] test_string_map.lifecycle (0 ms)
[ RUN      ] test_string_map.reserve_and_clear
[       OK ] test_string_map.reserve_and_clear (0 ms)
[ RUN      ] test_string_map.set_no_resize
[       OK ] test_string_map.set_no_resize (0 ms)
[ RUN      ] test_string_map.set
[       OK ] test_string_map.set (0 ms)
[ RUN      ] test_string_map.key_exists
[       OK ] test_string_map.key_exists (0 ms)
[ RUN      ] test_string_map.key_existsn
[       OK ] test_string_map.key_existsn (0 ms)
[ RUN      ] test_string_map.unset
[       OK ] test_string_map.unset (0 ms)
[ RUN      ] test_string_map.get
[       OK ] test_string_map.get (1 ms)
[ RUN      ] test_string_map.getn
[       OK ] test_string_map.getn (0 ms)
[ RUN      ] test_string_map.get_next_key
[       OK ] test_string_map.get_next_key (0 ms)
[ RUN      ] test_string_map.copy
[       OK ] test_string_map.copy (0 ms)
[ RUN      ] test_string_map.strange_keys
[       OK ] test_string_map.strange_keys (0 ms)
[----------] 12 tests from test_string_map (1 ms total)

[----------] 5 tests from TestStringMap
[ RUN      ] TestStringMap.getters_capacity_null_list
[       OK ] TestStringMap.getters_capacity_null_list (0 ms)
[ RUN      ] TestStringMap.getters_size_null_list
[       OK ] TestStringMap.getters_size_null_list (0 ms)
[ RUN      ] TestStringMap.getters_capacity_null_capacity
[       OK ] TestStringMap.getters_capacity_null_capacity (0 ms)
[ RUN      ] TestStringMap.getters_size_null_size
[       OK ] TestStringMap.getters_size_null_size (0 ms)
[ RUN      ] TestStringMap.getters_initialize_to_zero
[       OK ] TestStringMap.getters_initialize_to_zero (0 ms)
[----------] 5 tests from TestStringMap (0 ms total)

[----------] Global test environment tear-down
[==========] 17 tests from 2 test cases ran. (1 ms total)
[  PASSED  ] 17 tests.

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@wjwwood wjwwood added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Apr 16, 2019
@thomas-moulard
Copy link
Contributor Author

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@thomas-moulard
Copy link
Contributor Author

@wjwwood ready to merge!

@wjwwood wjwwood merged commit de45471 into ros2:master Apr 17, 2019
@wjwwood wjwwood removed the in review Waiting for review (Kanban column) label Apr 17, 2019
@thomas-moulard thomas-moulard deleted the thomas-moulard/test_string_map branch April 18, 2019 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_string_map is leaking memory
3 participants