From ebe68aad44dfd5f557f83d51d145835674781962 Mon Sep 17 00:00:00 2001 From: "wu@webrtc.org" Date: Tue, 20 Aug 2013 21:14:39 +0000 Subject: [PATCH] Fix memory leak in portallocatorsessionproxy_unittest. Remove the suppressions that have been fixed. BUG=1972,2263 R=mallinath@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2062005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4576 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../portallocatorsessionproxy_unittest.cc | 19 +++-- .../valgrind-webrtc/memcheck/suppressions.txt | 81 ++----------------- 2 files changed, 17 insertions(+), 83 deletions(-) diff --git a/talk/p2p/base/portallocatorsessionproxy_unittest.cc b/talk/p2p/base/portallocatorsessionproxy_unittest.cc index 2d3ec3dbe..689fb968d 100644 --- a/talk/p2p/base/portallocatorsessionproxy_unittest.cc +++ b/talk/p2p/base/portallocatorsessionproxy_unittest.cc @@ -59,7 +59,9 @@ class TestSessionChannel : public sigslot::has_slots<> { proxy_session_->SignalPortReady.connect( this, &TestSessionChannel::OnPortReady); } - virtual ~TestSessionChannel() {} + virtual ~TestSessionChannel() { + delete proxy_session_; + } void OnCandidatesReady(PortAllocatorSession* session, const std::vector& candidates) { EXPECT_EQ(proxy_session_, session); @@ -102,10 +104,11 @@ class PortAllocatorSessionProxyTest : public testing::Test { PortAllocatorSessionProxyTest() : socket_factory_(talk_base::Thread::Current()), allocator_(talk_base::Thread::Current(), NULL), - session_(talk_base::Thread::Current(), &socket_factory_, - "test content", 1, - kIceUfrag0, kIcePwd0), - session_muxer_(new PortAllocatorSessionMuxer(&session_)) { + session_(new cricket::FakePortAllocatorSession( + talk_base::Thread::Current(), &socket_factory_, + "test content", 1, + kIceUfrag0, kIcePwd0)), + session_muxer_(new PortAllocatorSessionMuxer(session_)) { } virtual ~PortAllocatorSessionProxyTest() {} void RegisterSessionProxy(PortAllocatorSessionProxy* proxy) { @@ -124,7 +127,7 @@ class PortAllocatorSessionProxyTest : public testing::Test { protected: talk_base::BasicPacketSocketFactory socket_factory_; cricket::FakePortAllocator allocator_; - cricket::FakePortAllocatorSession session_; + cricket::FakePortAllocatorSession* session_; // Muxer object will be delete itself after all registered session proxies // are deleted. PortAllocatorSessionMuxer* session_muxer_; @@ -143,7 +146,7 @@ TEST_F(PortAllocatorSessionProxyTest, TestLateBinding) { EXPECT_EQ_WAIT(1, channel1->candidates_count(), 1000); EXPECT_EQ(1, channel1->ports_count()); EXPECT_TRUE(channel1->allocation_complete()); - EXPECT_EQ(1, session_.port_config_count()); + EXPECT_EQ(1, session_->port_config_count()); // Creating another PortAllocatorSessionProxy and it also should receive // already happened events. PortAllocatorSessionProxy* proxy = @@ -154,7 +157,7 @@ TEST_F(PortAllocatorSessionProxyTest, TestLateBinding) { EXPECT_EQ_WAIT(1, channel2->candidates_count(), 1000); EXPECT_EQ(1, channel2->ports_count()); EXPECT_TRUE_WAIT(channel2->allocation_complete(), 1000); - EXPECT_EQ(1, session_.port_config_count()); + EXPECT_EQ(1, session_->port_config_count()); delete channel1; delete channel2; } diff --git a/tools/valgrind-webrtc/memcheck/suppressions.txt b/tools/valgrind-webrtc/memcheck/suppressions.txt index 074b317cf..2af0e91b7 100644 --- a/tools/valgrind-webrtc/memcheck/suppressions.txt +++ b/tools/valgrind-webrtc/memcheck/suppressions.txt @@ -369,80 +369,6 @@ #----------------------------------------------------------------------- # 2. libjingle stuff (talk folder) -{ - bug_1972_30 - Memcheck:Uninitialized - fun:dtls1_process_record - fun:dtls1_get_record - fun:dtls1_read_bytes - fun:ssl3_read_internal - ... -} -{ - bug_1972_40 - Memcheck:Leak - fun:_Znw* - fun:_ZN50PortAllocatorSessionProxyTest_TestLateBinding_Test8TestBodyEv -} -{ - bug_1972_45 - Memcheck:Uninitialized - fun:_ZN14DtlsTestClient12VerifyPacketEPKcmPj - ... -} -{ - bug_1972_50 - Memcheck:Leak - fun:_Znw* - fun:_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeIPN7sigslot22_signal_base_interfaceEEE8allocateEmPKv - fun:_ZNSt8_Rb_treeIPN7sigslot22_signal_base_interfaceES2_St9_IdentityIS2_ESt4lessIS2_ESaIS2_EE11_M_get_nodeEv - ... -} - -{ - bug_1972_56 - Memcheck:Leak - fun:_Znw* - fun:_ZN9__gnu_cxx13new_allocatorIPN7cricket25PortAllocatorSessionProxyEE8allocateEmPKv - ... -} -{ - bug_1972_57 - Memcheck:Leak - fun:_Znw* - fun:_ZN7sigslot7signal1IPN7cricket20PortAllocatorSessionENS_15single_threadedEE7connectINS1_25PortAllocatorSessionMuxerEEEvPT_MS8_FvS3_E - ... -} -{ - bug_1972_59 - Memcheck:Leak - fun:_Znw* - fun:_ZN9__gnu_cxx13new_allocatorISt10_List_nodeIPN7sigslot17_connection_base1IPN7cricket20PortAllocatorSessionENS2_15single_threadedEEEEE8allocateEmPKv - fun:_ZNSt10_List_baseIPN7sigslot17_connection_base1IPN7cricket20PortAllocatorSessionENS0_15single_threadedEEESaIS7_EE11_M_get_nodeEv - ... -} -{ - bug_1972_60 - Memcheck:Leak - fun:_Znw* - fun:_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKPN7cricket13PortInterfaceEPNS3_9PortProxyEEEE8allocateEmPKv - fun:_ZNSt8_Rb_treeIPN7cricket13PortInterfaceESt4pairIKS2_PNS0_9PortProxyEESt10_Select1stIS7_ESt4lessIS2_ESaIS7_EE11_M_get_nodeEv - ... -} -{ - bug_1972_62 - Memcheck:Leak - fun:_Znw* - fun:_ZN29PortAllocatorSessionProxyTestC1Ev - ... -} -{ - bug_1972_63 - Memcheck:Leak - fun:_Znw* - fun:_ZN29PortAllocatorSessionProxyTest13CreateChannelEv - ... -} { bug_2056_1 Memcheck:Leak @@ -616,4 +542,9 @@ fun:_ZN6webrtc20AudioDeviceLinuxALSA14InitMicrophoneEv ... } - +{ + bug_2263_1 + Memcheck:Uninitialized + fun:_ZN14DtlsTestClient12VerifyPacketEPKcmPj + ... +}