diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-02-17 18:48:33 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-02-17 19:09:21 +0100 |
commit | 9aa5ad4156a1ea1e8f73f88d3236218c6f37dea2 (patch) | |
tree | 59a3a9da042a97925763169044ad506d7a9f3d5c | |
parent | fb1d11d9a54738562994ee6f7a5875f7a62d5863 (diff) |
coverity: fix memory leak
Change-Id: I60d1845dbef9d53545db4bb743764bcb0b6a57cc
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index e0186a85f5be..6e7e16c0c679 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1289,14 +1289,14 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) CalendarWrapper aCalendar( comphelper::getComponentContext(pDoc->GetServiceManager()) ); aCalendar.loadDefaultCalendar( LanguageTag( eDocLang ).getLocale() ); - ::utl::TransliterationWrapper* pEnglishTransliteration = NULL; - CalendarWrapper* pEnglishCalendar = NULL; + boost::scoped_ptr< ::utl::TransliterationWrapper > pEnglishTransliteration; + boost::scoped_ptr< CalendarWrapper > pEnglishCalendar; if ( eDocLang != LANGUAGE_ENGLISH_US ) { - pEnglishTransliteration = new ::utl::TransliterationWrapper ( - comphelper::getComponentContext(pDoc->GetServiceManager()), SC_TRANSLITERATION_IGNORECASE ); + pEnglishTransliteration.reset(new ::utl::TransliterationWrapper ( + comphelper::getComponentContext(pDoc->GetServiceManager()), SC_TRANSLITERATION_IGNORECASE )); aTransliteration.loadModuleIfNeeded( LANGUAGE_ENGLISH_US ); - pEnglishCalendar = new CalendarWrapper ( comphelper::getComponentContext(pDoc->GetServiceManager()) ); + pEnglishCalendar.reset(new CalendarWrapper ( comphelper::getComponentContext(pDoc->GetServiceManager()) )); pEnglishCalendar->loadDefaultCalendar( LanguageTag( LANGUAGE_ENGLISH_US ).getLocale() ); } @@ -1363,7 +1363,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) bMultiLine |= lcl_PutString( pDoc, nCol, nRow, nTab, aCell, nFmt, &aNumFormatter, bDetectNumFormat, aTransliteration, aCalendar, - pEnglishTransliteration, pEnglishCalendar); + pEnglishTransliteration.get(), pEnglishCalendar.get()); } ++nCol; } @@ -1406,7 +1406,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) bMultiLine |= lcl_PutString( pDoc, nCol, nRow, nTab, aCell, nFmt, &aNumFormatter, bDetectNumFormat, aTransliteration, - aCalendar, pEnglishTransliteration, pEnglishCalendar); + aCalendar, pEnglishTransliteration.get(), pEnglishCalendar.get()); } ++nCol; } @@ -1447,8 +1447,6 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) ScReplaceWarnBox aBox( pDocSh->GetActiveDialogParent() ); if ( aBox.Execute() != RET_YES ) { - delete pEnglishTransliteration; - delete pEnglishCalendar; return false; } } @@ -1467,9 +1465,6 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) pDoc->DoColResize( nTab, nStartCol, nEndCol, 0 ); - delete pEnglishTransliteration; - delete pEnglishCalendar; - xProgress.reset(); // make room for AdjustRowHeight progress if (bRangeIsDetermined) EndPaste(); |