Fixing the memory leak in AudioEncoderCopyRedDeathTest.NullSpeechEncoder

Re-enable the test and explicitly call delete on red, even though the
test should die in the AudioEncoderCopyRed cunstructor. Apparently,
things work a little differently under memcheck.

BUG=4108, 3926
R=kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/38419004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7942 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org 2014-12-18 06:58:42 +00:00
parent 4fba293c87
commit cab1291745

View File

@ -308,14 +308,14 @@ TEST_F(AudioEncoderCopyRedDeathTest, WrongFrameSize) {
EXPECT_DEATH(Encode(), "");
}
// Test fails memcheck.
// https://code.google.com/p/webrtc/issues/detail?id=4108
TEST_F(AudioEncoderCopyRedDeathTest, DISABLED_NullSpeechEncoder) {
AudioEncoderCopyRed* red;
TEST_F(AudioEncoderCopyRedDeathTest, NullSpeechEncoder) {
AudioEncoderCopyRed* red = NULL;
AudioEncoderCopyRed::Config config;
config.speech_encoder = NULL;
EXPECT_DEATH(red = new AudioEncoderCopyRed(config),
"Speech encoder not provided.");
// The delete operation is needed to avoid leak reports from memcheck.
delete red;
}
#endif // GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)