From d6d014ff12259229be75754844403825114b0805 Mon Sep 17 00:00:00 2001 From: "henrike@webrtc.org" Date: Thu, 16 Feb 2012 02:18:09 +0000 Subject: [PATCH] Fixes memory leaks introduced in 1698. Review URL: https://webrtc-codereview.appspot.com/387014 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1701 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../rtp_rtcp/source/rtcp_format_remb_unittest.cc | 12 ++++++------ src/modules/rtp_rtcp/source/rtcp_sender_test.cc | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc b/src/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc index 7f3eb2ec5..9fdd6ca4c 100644 --- a/src/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc +++ b/src/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc @@ -61,6 +61,7 @@ class RtcpFormatRembTest : public ::testing::Test { virtual void SetUp(); virtual void TearDown(); + RtpRtcpClock* system_clock_; ModuleRtpRtcpImpl* dummy_rtp_rtcp_impl_; RTCPSender* rtcp_sender_; RTCPReceiver* rtcp_receiver_; @@ -68,12 +69,10 @@ class RtcpFormatRembTest : public ::testing::Test { }; void RtcpFormatRembTest::SetUp() { - dummy_rtp_rtcp_impl_ = - new ModuleRtpRtcpImpl(0, false, ModuleRTPUtility::GetSystemClock()); - rtcp_sender_ = new RTCPSender(0, false, ModuleRTPUtility::GetSystemClock(), - dummy_rtp_rtcp_impl_); - rtcp_receiver_ = new RTCPReceiver(0, ModuleRTPUtility::GetSystemClock(), - dummy_rtp_rtcp_impl_); + system_clock_ = ModuleRTPUtility::GetSystemClock(); + dummy_rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(0, false, system_clock_); + rtcp_sender_ = new RTCPSender(0, false, system_clock_, dummy_rtp_rtcp_impl_); + rtcp_receiver_ = new RTCPReceiver(0, system_clock_, dummy_rtp_rtcp_impl_); test_transport_ = new TestTransport(rtcp_receiver_); EXPECT_EQ(0, rtcp_sender_->Init()); @@ -85,6 +84,7 @@ void RtcpFormatRembTest::TearDown() { delete rtcp_receiver_; delete dummy_rtp_rtcp_impl_; delete test_transport_; + delete system_clock_; } TEST_F(RtcpFormatRembTest, TestBasicAPI) { diff --git a/src/modules/rtp_rtcp/source/rtcp_sender_test.cc b/src/modules/rtp_rtcp/source/rtcp_sender_test.cc index 81e8665dc..7b5b0573c 100644 --- a/src/modules/rtp_rtcp/source/rtcp_sender_test.cc +++ b/src/modules/rtp_rtcp/source/rtcp_sender_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -92,12 +92,10 @@ class TestTransport : public Transport, class RtcpSenderTest : public ::testing::Test { protected: RtcpSenderTest() { - rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(0, false, - ModuleRTPUtility::GetSystemClock()); - rtcp_sender_ = new RTCPSender(0, false, ModuleRTPUtility::GetSystemClock(), - rtp_rtcp_impl_); - rtcp_receiver_ = new RTCPReceiver(0, ModuleRTPUtility::GetSystemClock(), - rtp_rtcp_impl_); + system_clock_ = ModuleRTPUtility::GetSystemClock(); + rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(0, false, system_clock_); + rtcp_sender_ = new RTCPSender(0, false, system_clock_, rtp_rtcp_impl_); + rtcp_receiver_ = new RTCPReceiver(0, system_clock_, rtp_rtcp_impl_); test_transport_ = new TestTransport(rtcp_receiver_); // Initialize EXPECT_EQ(0, rtcp_sender_->Init()); @@ -109,8 +107,10 @@ class RtcpSenderTest : public ::testing::Test { delete rtcp_receiver_; delete rtp_rtcp_impl_; delete test_transport_; + delete system_clock_; } + RtpRtcpClock* system_clock_; ModuleRtpRtcpImpl* rtp_rtcp_impl_; RTCPSender* rtcp_sender_; RTCPReceiver* rtcp_receiver_;