输出格式显示堆栈,因此很难找到根本原因。
==21663== Invalid read of size 4
==21663== at 0x4448117: iurcall_init_rlmgt_IsAllAlcapSuccess(Iurcall_Init_CallCtx_t*) (iurcall_init_rlmgt_p.cc:6319)
==21663== by 0x47D98DD: iurcall_init_rlmgt_IsAllAlcapSuccess_Test_return_1_when_edchMacD_flow_ctx_not_exist_and_alcapEstablish_is_FALSE_Test::TestBody() (iurcall_init_rlmgt_p_test.cc:373)
==21663== by 0x8BCAB27: testing::Test::Run() (gmock-gtest-all.cc:3436)
==21663== by 0x8BD1966: testing::internal::TestInfoImpl::Run() (gmock-gtest-all.cc:3655)
==21663== by 0x8BD1AA8: testing::TestCase::Run() (gmock-gtest-all.cc:3761)
==21663== by 0x8BD1D96: testing::internal::UnitTestImpl::RunAllTests() (gmock-gtest-all.cc:5365)
==21663== by 0x8BD1F21: testing::UnitTest::Run() (gmock-gtest-all.cc:5028)
==21663== by 0x4820149: Gtest_initialisation(int, char**) (iurcall_init_gtest_main.cc:49)
==21663== by 0x808E500: main (bosinit_config_template.h:439)
==21663== Address 0xa8190e4 is 44 bytes inside a block of size 56 free'd
答案 0 :(得分:0)
此Valgrind输出看起来不完整。它应该类似于this question,其中第二个调用堆栈是在Address 0xa8190e4 is 44 bytes inside a block of size 56 free'd
之后打印的。
此调用堆栈是问题的根本原因。这不是内存泄漏。您正在尝试使用已经解除分配的对象。第二个调用堆栈是释放对象的位置,第一个是使用它的位置。