summaryrefslogtreecommitdiff
path: root/vcl/qa
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-30 15:38:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-30 15:38:17 +0100
commita15d8458c67a769dd59e6237e012d6ec69331582 (patch)
treedaedf8d616ad15d3bcc57ee1266727affd24aa53 /vcl/qa
parentccef4d977b87c470340dfc89ab590d718804f297 (diff)
coverity#1405740 Resource leak
Change-Id: I6537e818a783ef908e2ae4d068752669529fb75e
Diffstat (limited to 'vcl/qa')
-rw-r--r--vcl/qa/cppunit/errorhandler.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/vcl/qa/cppunit/errorhandler.cxx b/vcl/qa/cppunit/errorhandler.cxx
index defc218fac5f..fc06ec1869d2 100644
--- a/vcl/qa/cppunit/errorhandler.cxx
+++ b/vcl/qa/cppunit/errorhandler.cxx
@@ -45,17 +45,20 @@ public:
void ErrorHandlerTest::testGetErrorString()
{
MockErrorHandler aErrHdlr;
+ std::unique_ptr<ErrorInfo> xErrorInfo;
OUString aErrStr;
CPPUNIT_ASSERT_MESSAGE("GetErrorString(ERRCODE_ABORT, aErrStr) should return false",
!ErrorHandler::GetErrorString(ERRCODE_ABORT, aErrStr));
// normally protected, but MockErrorHandler is a friend of this class
- aErrHdlr.CreateString(ErrorInfo::GetErrorInfo(ERRCODE_ABORT), aErrStr);
+ xErrorInfo.reset(ErrorInfo::GetErrorInfo(ERRCODE_ABORT));
+ aErrHdlr.CreateString(xErrorInfo.get(), aErrStr);
CPPUNIT_ASSERT_EQUAL_MESSAGE("error message should be non-dynamic", OUString("Non-dynamic error"), aErrStr);
CPPUNIT_ASSERT_MESSAGE("GetErrorString(ERRCODE_NONE, aErrStr) should return false",
!ErrorHandler::GetErrorString(ERRCODE_NONE, aErrStr));
- aErrHdlr.CreateString(ErrorInfo::GetErrorInfo(ERRCODE_NONE), aErrStr);
+ xErrorInfo.reset(ErrorInfo::GetErrorInfo(ERRCODE_NONE));
+ aErrHdlr.CreateString(xErrorInfo.get(), aErrStr);
CPPUNIT_ASSERT_EQUAL_MESSAGE("error message should be non-dynamic", OUString("Non-dynamic error"), aErrStr);
}