diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-03-28 19:17:53 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2014-03-28 19:20:53 +0900 |
commit | e3bd2ee4e00185d6e0e57aba7046634142d614b8 (patch) | |
tree | 02694526f8417518eabb5a2d2ddb22ed0faabb50 /dbaccess/source | |
parent | 8b533d84f3ae211fdfafc2adc8d8567f366771d4 (diff) |
Avoid possible resource leaks by boost::scoped_array
Change-Id: Ie20fc857f19f74aaccb546f9bfa11a7a657d3e8a
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/ui/misc/TokenWriter.cxx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index cda597a5eb7e..22dde9d69ecc 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -56,6 +56,7 @@ #include <svtools/htmlcfg.hxx> #include <connectivity/formattedcolumnvalue.hxx> #include <unotools/syslocale.hxx> +#include <boost/scoped_array.hpp> using namespace dbaui; using namespace dbtools; @@ -453,7 +454,7 @@ sal_Bool ORTFImportExport::Write() m_pStream->WriteChar( '{' ).WriteCharPtr( SAL_NEWLINE_STRING ); m_pStream->WriteCharPtr( aTRRH ); - OString* pHorzChar = new OString[nCount]; + boost::scoped_array<OString> pHorzChar(new OString[nCount]); for ( sal_Int32 i=1; i <= nCount; ++i ) { @@ -527,7 +528,7 @@ sal_Bool ORTFImportExport::Write() } if ( bContinue ) - appendRow( pHorzChar, nCount, k, kk ); + appendRow( pHorzChar.get(), nCount, k, kk ); } } else @@ -535,10 +536,9 @@ sal_Bool ORTFImportExport::Write() m_xResultSet->beforeFirst(); // set back before the first row while(m_xResultSet->next()) { - appendRow(pHorzChar,nCount,k,kk); + appendRow(pHorzChar.get(),nCount,k,kk); } } - delete [] pHorzChar; } m_pStream->WriteChar( '}' ).WriteCharPtr( SAL_NEWLINE_STRING ); @@ -826,10 +826,10 @@ void OHTMLImportExport::WriteTables() if(m_xObject.is()) { - sal_Int32* pFormat = new sal_Int32[aNames.getLength()]; + boost::scoped_array<sal_Int32> pFormat(new sal_Int32[aNames.getLength()]); - const char **pHorJustify = new const char*[aNames.getLength()]; - sal_Int32 *pColWidth = new sal_Int32[aNames.getLength()]; + boost::scoped_array<const char *> pHorJustify(new const char*[aNames.getLength()]); + boost::scoped_array<sal_Int32> pColWidth(new sal_Int32[aNames.getLength()]); sal_Int32 nHeight = 0; m_xObject->getPropertyValue(PROPERTY_ROW_HEIGHT) >>= nHeight; @@ -911,10 +911,6 @@ void OHTMLImportExport::WriteTables() ++j; TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow ); } - - delete [] pFormat; - delete [] pHorJustify; - delete [] pColWidth; } else { |