summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-26 03:17:23 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-26 03:17:23 +0000
commitd47d090d36b76c50eb80e035a426a4d8e59a2b5a (patch)
treed212532d69b70c197327198adc1fabb62aab0393
parent5cffc739a121a55ade333e4a504eeb8f9c78aacf (diff)
downloadchromium_src-d47d090d36b76c50eb80e035a426a4d8e59a2b5a.zip
chromium_src-d47d090d36b76c50eb80e035a426a4d8e59a2b5a.tar.gz
chromium_src-d47d090d36b76c50eb80e035a426a4d8e59a2b5a.tar.bz2
Fixed memory leaks in remoting_unittests.
BUG=70826 TEST=remoting_unittests under valgrind Review URL: http://codereview.chromium.org/6266020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72601 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--remoting/protocol/message_reader_unittest.cc17
-rw-r--r--tools/valgrind/memcheck/suppressions.txt8
2 files changed, 11 insertions, 14 deletions
diff --git a/remoting/protocol/message_reader_unittest.cc b/remoting/protocol/message_reader_unittest.cc
index 5f17a1a..3237cb5 100644
--- a/remoting/protocol/message_reader_unittest.cc
+++ b/remoting/protocol/message_reader_unittest.cc
@@ -59,6 +59,11 @@ class MessageReaderTest : public testing::Test {
return result == expected;
}
+ void RunAndDeleteTask(Task* task) {
+ task->Run();
+ delete task;
+ }
+
// MessageLoop must be first here, so that is is destroyed the last.
MessageLoop message_loop_;
@@ -90,7 +95,7 @@ TEST_F(MessageReaderTest, OneMessage_Delay) {
// finished processing the previous message.
EXPECT_FALSE(socket_.read_pending());
- done_task->Run();
+ RunAndDeleteTask(done_task);
EXPECT_TRUE(socket_.read_pending());
}
@@ -137,11 +142,11 @@ TEST_F(MessageReaderTest, TwoMessages_Together) {
// finished processing the previous message.
EXPECT_FALSE(socket_.read_pending());
- done_task1->Run();
+ RunAndDeleteTask(done_task1);
EXPECT_FALSE(socket_.read_pending());
- done_task2->Run();
+ RunAndDeleteTask(done_task2);
EXPECT_TRUE(socket_.read_pending());
}
@@ -172,7 +177,7 @@ TEST_F(MessageReaderTest, TwoMessages_Instant) {
// finished processing the second message.
EXPECT_FALSE(socket_.read_pending());
- done_task2->Run();
+ RunAndDeleteTask(done_task2);
EXPECT_TRUE(socket_.read_pending());
}
@@ -216,7 +221,7 @@ TEST_F(MessageReaderTest, TwoMessages_Separately) {
// finished processing the previous message.
EXPECT_FALSE(socket_.read_pending());
- done_task->Run();
+ RunAndDeleteTask(done_task);
EXPECT_TRUE(socket_.read_pending());
@@ -233,7 +238,7 @@ TEST_F(MessageReaderTest, TwoMessages_Separately) {
// finished processing the previous message.
EXPECT_FALSE(socket_.read_pending());
- done_task->Run();
+ RunAndDeleteTask(done_task);
EXPECT_TRUE(socket_.read_pending());
}
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt
index 69024f1..fe645b6 100644
--- a/tools/valgrind/memcheck/suppressions.txt
+++ b/tools/valgrind/memcheck/suppressions.txt
@@ -3694,11 +3694,3 @@
fun:_Znw*
fun:_ZN27ExtensionFunctionDispatcherC1EP14RenderViewHostPNS_8DelegateEPK9ExtensionRK4GURL
}
-{
- bug_70826
- Memcheck:Leak
- fun:_Znw*
- fun:_Z17NewRunnableMethodIN8remoting8protocol13MessageReaderEMS2_FvPNS0_14CompoundBufferEES4_EP14CancelableTaskPT_T0_RKT1_
- fun:_ZN8remoting8protocol13MessageReader14OnDataReceivedEPN3net8IOBufferEi
- fun:_ZN8remoting8protocol13MessageReader16HandleReadResultEi
-}