cui/source/dialogs/cuigaldlg.cxx | 6 ++--- hwpfilter/source/drawing.h | 5 ++-- hwpfilter/source/hwpread.cxx | 2 - xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx | 19 ++++++------------ xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 4 +-- 5 files changed, 16 insertions(+), 20 deletions(-)
New commits: commit ff2037b76c83fca0371a78005283d641103565d0 Author: Noel Grandin <[email protected]> AuthorDate: Fri Sep 7 14:05:28 2018 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Sep 8 17:50:19 2018 +0200 loplugin:useuniqueptr in TakeThread Change-Id: I5d3d197d57235f2bd09cbf80a7a35314edda945d Reviewed-on: https://gerrit.libreoffice.org/60192 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index fe99c5373ede..046aa4a5f26a 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -277,11 +277,11 @@ void TakeThread::execute() { sal_Int32 nEntries; GalleryTheme* pThm = mpBrowser->GetXChgData()->pTheme; - GalleryProgress* pStatusProgress; + std::unique_ptr<GalleryProgress> pStatusProgress; { SolarMutexGuard aGuard; - pStatusProgress = new GalleryProgress; + pStatusProgress.reset(new GalleryProgress); nEntries = mpBrowser->bTakeAll ? mpBrowser->m_pLbxFound->GetEntryCount() : mpBrowser->m_pLbxFound->GetSelectedEntryCount(); pThm->LockBroadcaster(); } @@ -307,7 +307,7 @@ void TakeThread::execute() SolarMutexGuard aGuard; pThm->UnlockBroadcaster(); - delete pStatusProgress; + pStatusProgress.reset(); } Application::PostUserEvent( LINK( mpProgress, TakeProgress, CleanUpHdl ), nullptr, true ); commit 4907cf58bae433b833aa7fedc6a8aafd45e75a75 Author: Caolán McNamara <[email protected]> AuthorDate: Sat Sep 8 14:45:38 2018 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sat Sep 8 17:50:17 2018 +0200 ofz#10259 ofz#10263 ofz#10264 ofz#10265 use-after-free Change-Id: I3e845c21f7a4e853ce9548f2992cab324dec05a8 Reviewed-on: https://gerrit.libreoffice.org/60200 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/hwpfilter/source/drawing.h b/hwpfilter/source/drawing.h index 5c2746da0099..3118ec0c8720 100644 --- a/hwpfilter/source/drawing.h +++ b/hwpfilter/source/drawing.h @@ -85,7 +85,7 @@ HWPDOFuncType HWPDOFuncTbl[] = HWPDOFreeFormFunc, }; -static HMemIODev *hmem = nullptr; +static HIODev *hmem = nullptr; static int count = 0; @@ -631,7 +631,8 @@ static HWPPara *LoadParaList() std::vector< HWPPara* > plist; hwpf->ReadParaList(plist); - hwpf->SetIODevice(std::move(hio)); + std::unique_ptr<HIODev> orighmem = hwpf->SetIODevice(std::move(hio)); + hmem = orighmem.release(); return plist.size()? plist.front() : nullptr; } diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index 1ed8001513af..9d44a00bc87b 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -460,7 +460,7 @@ bool Picture::Read(HWPFile & hwpf) if (pictype == PICTYPE_DRAW) { - HMemIODev* pOldMem = hmem; + HIODev* pOldMem = hmem; HMemIODev* pNewMem = new HMemIODev(reinterpret_cast<char *>(follow.data()), follow_block_size); hmem = pNewMem; LoadDrawingObjectBlock(this); commit cbf8f81156840bffff524d74d02d70a5530a0a37 Author: Noel Grandin <[email protected]> AuthorDate: Fri Sep 7 09:59:27 2018 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Sep 8 17:50:13 2018 +0200 loplugin:useuniqueptr in xmlhelp Change-Id: I8a407e0492adf61e1d815cadd5da0a1623c2b23b Reviewed-on: https://gerrit.libreoffice.org/60191 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx index 647bff41e982..92e20e6049d0 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx @@ -119,7 +119,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte OUString idxDir; bool bExtension = false; int iDir = 0; - vector< vector<HitItem>* > aIndexFolderResultVectorVector; + vector< vector<HitItem> > aIndexFolderResultVectorVector; bool bTemporary; while( !(idxDir = aIndexFolderIt.nextIndexFolder( bExtension, bTemporary )).isEmpty() ) @@ -236,8 +236,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte sort( aIndexFolderResultVector.begin(), aIndexFolderResultVector.end() ); } - vector<HitItem>* pIndexFolderHitItemVector = new vector<HitItem>( aIndexFolderResultVector ); - aIndexFolderResultVectorVector.push_back( pIndexFolderHitItemVector ); + aIndexFolderResultVectorVector.push_back( std::move(aIndexFolderResultVector) ); aIndexFolderResultVector.clear(); } catch (const Exception &e) @@ -254,7 +253,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte int nVectorCount = aIndexFolderResultVectorVector.size(); - vector<HitItem>::size_type* pCurrentVectorIndex = new vector<HitItem>::size_type[nVectorCount]; + std::unique_ptr<std::vector<HitItem>::size_type[]> pCurrentVectorIndex(new vector<HitItem>::size_type[nVectorCount]); for( int j = 0 ; j < nVectorCount ; ++j ) pCurrentVectorIndex[j] = 0; @@ -266,7 +265,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte float fBestScore = 0.0; for( int k = 0 ; k < nVectorCount ; ++k ) { - vector<HitItem>& rIndexFolderVector = *aIndexFolderResultVectorVector[k]; + vector<HitItem>& rIndexFolderVector = aIndexFolderResultVectorVector[k]; if( pCurrentVectorIndex[k] < rIndexFolderVector.size() ) { const HitItem& rItem = rIndexFolderVector[ pCurrentVectorIndex[k] ]; @@ -282,7 +281,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte if( iVectorWithBestScore == -1 ) // No item left at all break; - vector<HitItem>& rIndexFolderVector = *aIndexFolderResultVectorVector[iVectorWithBestScore]; + vector<HitItem>& rIndexFolderVector = aIndexFolderResultVectorVector[iVectorWithBestScore]; const HitItem& rItem = rIndexFolderVector[ pCurrentVectorIndex[iVectorWithBestScore] ]; pCurrentVectorIndex[iVectorWithBestScore]++; @@ -291,12 +290,8 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte ++nHitCount; } - delete[] pCurrentVectorIndex; - for( int n = 0 ; n < nVectorCount ; ++n ) - { - vector<HitItem>* pIndexFolderVector = aIndexFolderResultVectorVector[n]; - delete pIndexFolderVector; - } + pCurrentVectorIndex.reset(); + aIndexFolderResultVectorVector.clear(); sal_Int32 replIdx = OUString( "#HLP#" ).getLength(); OUString replWith = "vnd.sun.star.help://"; diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 8707e3a478b2..85e4cb4051ad 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -338,7 +338,7 @@ void URLParameter::open( const Reference< XOutputStream >& xDataSink ) return; // a standard document or else an active help text, plug in the new input stream - InputStreamTransformer* p = new InputStreamTransformer( this,m_pDatabases,isRoot() ); + std::unique_ptr<InputStreamTransformer> p(new InputStreamTransformer( this,m_pDatabases,isRoot() )); try { xDataSink->writeBytes( Sequence< sal_Int8 >( reinterpret_cast<const sal_Int8*>(p->getData().getStr()), p->getData().getLength() ) ); @@ -346,7 +346,7 @@ void URLParameter::open( const Reference< XOutputStream >& xDataSink ) catch( const Exception& ) { } - delete p; + p.reset(); xDataSink->closeOutput(); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
