summaryrefslogtreecommitdiff
path: root/xmlhelp
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-27 10:34:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-01 08:16:46 +0200
commit52d0aca586f3754cfab997387a9fb11fe9f63fc8 (patch)
treefec507c8d6d84a714d45a791e4310ccaf7900fa4 /xmlhelp
parentc490bfac65ae2a95eddcf027c1b402aa2a199522 (diff)
loplugin:useuniqueptr in TVChildTarget
Change-Id: I5d51df50a0c2279c52273254c451f3f21eaafbfb Reviewed-on: https://gerrit.libreoffice.org/61112 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlhelp')
-rw-r--r--xmlhelp/source/treeview/tvread.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 1035cdd9c3aa..19d4b5b3f942 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -400,10 +400,10 @@ TVChildTarget::TVChildTarget( const Reference< XComponentContext >& xContext )
while( j )
{
len = configData.vFileLen[--j];
- char* s = new char[ int(len) ]; // the buffer to hold the installed files
+ std::unique_ptr<char[]> s(new char[ int(len) ]); // the buffer to hold the installed files
osl::File aFile( configData.vFileURL[j] );
aFile.open( osl_File_OpenFlag_Read );
- aFile.read( s,len,ret );
+ aFile.read( s.get(),len,ret );
aFile.close();
XML_Parser parser = XML_ParserCreate( nullptr );
@@ -414,12 +414,11 @@ TVChildTarget::TVChildTarget( const Reference< XComponentContext >& xContext )
data_handler);
XML_SetUserData( parser,&pTVDom ); // does not return this
- XML_Status const parsed = XML_Parse(parser, s, int(len), j==0);
+ XML_Status const parsed = XML_Parse(parser, s.get(), int(len), j==0);
SAL_WARN_IF(XML_STATUS_ERROR == parsed, "xmlhelp",
"TVChildTarget::TVChildTarget(): Tree file parsing failed");
XML_ParserFree( parser );
- delete[] s;
Check(pTVDom);
}