Commit 0a9dafbe authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2445] make initializaation for BufferAppenderTest more exception safe.

by encapsulating the appender in SharedAppenderPtr immediately after the
creation, we can make sure buffer_appender1 won't leak even if the
creation of the second appender fails.
parent 8065343b
......@@ -45,8 +45,8 @@ public:
class BufferAppenderTest : public ::testing::Test {
protected:
BufferAppenderTest() : buffer_appender1(new TestBufferAppender()),
buffer_appender2(new TestBufferAppender()),
appender1(buffer_appender1),
buffer_appender2(new TestBufferAppender()),
appender2(buffer_appender2),
logger(log4cplus::Logger::getInstance("buffer"))
{
......@@ -69,8 +69,8 @@ protected:
}
TestBufferAppender* buffer_appender1;
TestBufferAppender* buffer_appender2;
log4cplus::SharedAppenderPtr appender1;
TestBufferAppender* buffer_appender2;
log4cplus::SharedAppenderPtr appender2;
log4cplus::Logger logger;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment