Skip to content

LeakSanitizer: detected memory leaks in cJSON_New_Item and others #3330

Closed

Description

@AtnNn

When running the JSON and RDBInterrupt unit tests with clang address sanitiziation (#3294):

==450==ERROR: LeakSanitizer: detected memory leaks

 Direct leak of 504 byte(s) in 7 object(s) allocated from:
     #0 0x164e82b in __interceptor_malloc /home/ssd1/atnnn/src/llvm-3.5.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:40
     #1 0x6a66ef5 in rmalloc(unsigned long) /home/atnnn/code/rethinkdb/src/utils.cc:215:17
     #2 0x3fbeee1 in cJSON_New_Item() /home/atnnn/code/rethinkdb/src/http/json/cJSON.cc:82:31
     #3 0x3fc6718 in cJSON_CreateBlank /home/atnnn/code/rethinkdb/src/http/json/cJSON.cc:704:57
     #4 0x6917f9d in unittest::JSON_Compare_Test::TestBody() /home/atnnn/code/rethinkdb/src/unittest/json.cc:201:27
     #5 0x6c15ae2 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (test
     #6 0x6c08280 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing
     #7 0x6bf1016 in testing::Test::Run() /../src/gtest.cc:2061
     #8 0x6bf1e5b in testing::TestInfo::Run() /../src/gtest.cc:2237
     #9 0x6bf2614 in testing::TestCase::Run() /../src/gtest.cc:2344
     #10 0x6bf871f in testing::internal::UnitTestImpl::RunAllTests() /../src/gtest.cc:4066
     #11 0x6c129c2 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing
     #12 0x6c0a110 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::i
     #13 0x6bf8401 in testing::UnitTest::Run() /../src/gtest.cc:3699
     #14 0x6bc6050 in RUN_ALL_TESTS() /home/atnnn/code/rethinkdb/./build/external/gtest_1.6.0/include/gtest/gtest.h:2236:10
     #15 0x6bc5ce0 in main /home/atnnn/code/rethinkdb/src/unittest/main.cc:8:12
     #16 0x7fc18f0ab76c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226

 Direct leak of 8 byte(s) in 1 object(s) allocated from:
     #0 0x15e6f4b in operator new(unsigned long) /home/ssd1/atnnn/src/llvm-3.5.0.src/projects/compiler-rt/lib/asan/asan_new_delete.
     #1 0x62e7837 in unittest::test_rdb_env_t::add_table(std::string const&, uuid_u const&, std::string const&, std::set<std::map<s
     #2 0x64dfc46 in unittest::RDBInterrupt_DeleteOp_Test::TestBody() /home/atnnn/code/rethinkdb/src/unittest/rdb_interruptor.cc:30
     #3 0x6c15ae2 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (test
     #4 0x6c08280 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing
     #5 0x6bf1016 in testing::Test::Run() /../src/gtest.cc:2061
     #6 0x6bf1e5b in testing::TestInfo::Run() /../src/gtest.cc:2237
     #7 0x6bf2614 in testing::TestCase::Run() /../src/gtest.cc:2344
     #8 0x6bf871f in testing::internal::UnitTestImpl::RunAllTests() /../src/gtest.cc:4066
     #9 0x6c129c2 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing:
     #10 0x6c0a110 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::i
     #11 0x6bf8401 in testing::UnitTest::Run() /../src/gtest.cc:3699
     #12 0x6bc6050 in RUN_ALL_TESTS() /home/atnnn/code/rethinkdb/./build/external/gtest_1.6.0/include/gtest/gtest.h:2236:10
     #13 0x6bc5ce0 in main /home/atnnn/code/rethinkdb/src/unittest/main.cc:8:12
     #14 0x7f2a3476b76c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226

 Indirect leak of 10 byte(s) in 2 object(s) allocated from:
     #0 0x164e82b in __interceptor_malloc /home/ssd1/atnnn/src/llvm-3.5.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:40
     #1 0x6a66ef5 in rmalloc(unsigned long) /home/atnnn/code/rethinkdb/src/utils.cc:215:17
     #2 0x3fc2c5b in cJSON_strdup(char const*) /home/atnnn/code/rethinkdb/src/http/json/cJSON.cc:62:27
     #3 0x3fc7536 in cJSON_CreateString /home/atnnn/code/rethinkdb/src/http/json/cJSON.cc:710:135
     #4 0x62e79a3 in unittest::test_rdb_env_t::add_table(std::string const&, uuid_u const&, std::string const&, std::set<std::map<s
     #5 0x64dfc46 in unittest::RDBInterrupt_DeleteOp_Test::TestBody() /home/atnnn/code/rethinkdb/src/unittest/rdb_interruptor.cc:30
     #6 0x6c15ae2 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (test
     #7 0x6c08280 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing
     #8 0x6bf1016 in testing::Test::Run() /../src/gtest.cc:2061
     #9 0x6bf1e5b in testing::TestInfo::Run() /../src/gtest.cc:2237
     #10 0x6bf2614 in testing::TestCase::Run() /../src/gtest.cc:2344
     #11 0x6bf871f in testing::internal::UnitTestImpl::RunAllTests() /../src/gtest.cc:4066
     #12 0x6c129c2 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing
     #13 0x6c0a110 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::i
     #14 0x6bf8401 in testing::UnitTest::Run() /../src/gtest.cc:3699
     #15 0x6bc6050 in RUN_ALL_TESTS() /home/atnnn/code/rethinkdb/./build/external/gtest_1.6.0/include/gtest/gtest.h:2236:10
     #16 0x6bc5ce0 in main /home/atnnn/code/rethinkdb/src/unittest/main.cc:8:12
     #17 0x7f2a3476b76c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226

Activity

  1. added this to the milestone on Nov 15, 2014
  2. modified the milestones: , subsequent on Jan 2, 2015
  3. danielmewes commented on Apr 29, 2016

    @danielmewes
    Member

    We're no longer using cJSON, except for very old secondary indexes. Closing as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions