basic/source/runtime/iosys.cxx | 1 + chart2/source/controller/dialogs/res_BarGeometry.cxx | 2 +- cui/source/customize/cfg.cxx | 1 + cui/source/options/treeopt.cxx | 5 +---- extensions/source/nsplugin/source/npshell.cxx | 2 ++ extensions/source/plugin/unx/npnapi.cxx | 3 +++ extensions/source/plugin/unx/plugcon.cxx | 13 ++++++++++--- filter/source/flash/swfexporter.cxx | 3 +++ svtools/source/graphic/grfmgr2.cxx | 10 ++++++---- svtools/source/graphic/provider.cxx | 5 +++-- sw/source/filter/ww1/w1class.cxx | 4 ++-- vcl/inc/vcl/gdimtf.hxx | 3 +++ vcl/source/gdi/bitmap4.cxx | 3 +++ vcl/source/gdi/cvtsvm.cxx | 15 +++++++++------ vcl/source/gdi/gdimtf.cxx | 5 +++++ 15 files changed, 53 insertions(+), 22 deletions(-)
New commits: commit ac9c6e4da094f5b7ae3e8c45bf7f1c61376e7ff2 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Mar 2 04:09:35 2013 +0100 coverity#982991: fix memory leak Change-Id: I083d1c22daefacefd59a918073ed605aa318bdce diff --git a/filter/source/flash/swfexporter.cxx b/filter/source/flash/swfexporter.cxx index 29da268..81c7f76 100644 --- a/filter/source/flash/swfexporter.cxx +++ b/filter/source/flash/swfexporter.cxx @@ -614,7 +614,10 @@ void FlashExporter::exportShape( Reference< XShape >& xShape, bool bMaster ) } if (!nID) + { + delete pShapeInfo; return; + } pShapeInfo->mnID = nID; commit fca5e0992f153e1e821d4dd9bd35c11c39cdb6ec Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Mar 2 04:03:48 2013 +0100 coverity#982975 and more: fix memory leaks Change-Id: I4c147ea03eb4d5d7c926ec1cccbd344ff28c77d7 diff --git a/extensions/source/plugin/unx/plugcon.cxx b/extensions/source/plugin/unx/plugcon.cxx index cc0d3b5..7683825 100644 --- a/extensions/source/plugin/unx/plugcon.cxx +++ b/extensions/source/plugin/unx/plugcon.cxx @@ -114,7 +114,9 @@ MediatorMessage* PluginConnector::Transact( const char* pFunction, va_start( ap, nFunctionLen ); sal_uLong nSize = FillBuffer( pBuffer, pFunction, nFunctionLen, ap ); va_end( ap ); - return TransactMessage( nSize, pBuffer ); + MediatorMessage* pRet = TransactMessage( nSize, pBuffer ); + delete[] pBuffer; + return pRet; } MediatorMessage* PluginConnector::Transact( sal_uInt32 nFunction, ... ) @@ -125,7 +127,9 @@ MediatorMessage* PluginConnector::Transact( sal_uInt32 nFunction, ... ) va_start( ap, nFunction ); sal_uLong nSize = FillBuffer( pBuffer, (char*)&nFunction, sizeof( nFunction ), ap ); va_end( ap ); - return TransactMessage( nSize, pBuffer ); + MediatorMessage* pRet = TransactMessage( nSize, pBuffer ); + delete[] pBuffer; + return pRet; } sal_uLong PluginConnector::Send( sal_uInt32 nFunction, ... ) @@ -136,7 +140,9 @@ sal_uLong PluginConnector::Send( sal_uInt32 nFunction, ... ) va_start( ap, nFunction ); sal_uLong nSize = FillBuffer( pBuffer, (char*)&nFunction, sizeof( nFunction ), ap ); va_end( ap ); - return SendMessage( nSize, pBuffer ); + sal_uLong nRet = SendMessage( nSize, pBuffer ); + delete[] pBuffer; + return nRet; } void PluginConnector::Respond( sal_uLong nID, @@ -150,6 +156,7 @@ void PluginConnector::Respond( sal_uLong nID, sal_uLong nSize = FillBuffer( pBuffer, pFunction, nFunctionLen, ap ); va_end( ap ); SendMessage( nSize, pBuffer, nID | ( 1 << 24 ) ); + delete[] pBuffer; } MediatorMessage* PluginConnector::WaitForAnswer( sal_uLong nMessageID ) commit 5ff1afbf1ef1dbea81c156572e7cd125bde70778 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Mar 2 03:57:42 2013 +0100 coverity#982974: fix memory leak Change-Id: I8501d26e0f0447b219ecbbdc9262f13158f5aa0a diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx index bfc6fa1..90b82bc 100644 --- a/extensions/source/plugin/unx/npnapi.cxx +++ b/extensions/source/plugin/unx/npnapi.cxx @@ -288,7 +288,10 @@ static NPError l_NPN_RequestRead( NPStream* stream, NPByteRange* rangeList ) NULL ); if( ! pMes ) + { + delete[] pArray; return NPERR_GENERIC_ERROR; + } NPError aRet = pConnector->GetNPError( pMes ); delete [] pArray; commit f05ef81b31bd0ca16278a8396f42fca75ca038c5 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Mar 2 03:50:55 2013 +0100 coverity#982972 & coverity#982971: fix memory leak Change-Id: I3fa44aa5651584c5a90d9e18c75d0c825fcf05fc diff --git a/extensions/source/nsplugin/source/npshell.cxx b/extensions/source/nsplugin/source/npshell.cxx index f476d1c..b1d3e19 100644 --- a/extensions/source/nsplugin/source/npshell.cxx +++ b/extensions/source/nsplugin/source/npshell.cxx @@ -784,6 +784,8 @@ NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) { debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile:short write to %s. error: %s \n", localPathNew, strerror(errno)); + close(fdSrc); + close(fdDst); return; } } commit 3c1c6afa2e6671af8508e39b83a58f026655d7eb Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Mar 2 03:47:41 2013 +0100 coverity#982967: fix memory leak Change-Id: Ie96353daa1947297eff417d32ba4c67964489a16 diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index abe67f6..05a28f8 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -2082,6 +2082,7 @@ SvTreeListEntry* SvxConfigPage::AddFunction( // asynchronous error message, because of MsgBoxes PostUserEvent( LINK( this, SvxConfigPage, AsyncInfoMsg ) ); + delete pNewEntryData; return NULL; } commit d021bb4dae80a194c196c8885bc5125b78476bd8 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Mar 2 03:34:30 2013 +0100 coverity: fix memory leak Change-Id: I17a09015d98a98349571a35492d516724ae2daa9 diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index 1fccd92..4daa688 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -216,6 +216,7 @@ bool needSecurityRestrictions( void ) oslSecurity aSecurity = osl_getCurrentSecurity(); OUString aSystemUser; sal_Bool bRet = osl_getUserName( aSecurity, &aSystemUser.pData ); + osl_freeSecurityHandle(aSecurity); if( !bRet ) { // No valid security! -> Secure mode! commit a935faad11d5306631ac746ea5febaf06822bc66 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Mar 2 03:24:19 2013 +0100 coverity#736572: possible memory leak and memory corruption + docu Change-Id: I2f1aad214481903866cd496542d961245fae47d1 diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index fd8679e..329e34d 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -1311,15 +1311,17 @@ sal_Bool GraphicManager::ImplCreateOutput( OutputDevice* pOut, } if ( pModAct ) { - rOutMtf.ReplaceAction( pModAct, nCurPos ); - pAct->Delete(); + MetaAction* pDeleteAction = rOutMtf.ReplaceAction( pModAct, nCurPos ); + assert(pDeleteAction); + pDeleteAction->Delete(); } else { if( pAct->GetRefCount() > 1 ) { - rOutMtf.ReplaceAction( pModAct = pAct->Clone(), nCurPos ); - pAct->Delete(); + MetaAction* pDeleteAction = rOutMtf.ReplaceAction( pModAct = pAct->Clone(), nCurPos ); + assert(pDeleteAction); + pDeleteAction->Delete(); } else pModAct = pAct; diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index 1407087..7148fa3 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -742,8 +742,9 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal else pNewAction = new MetaBmpExScaleAction( aPos, aSize, aGraphic.GetBitmapEx() ); - aMtf.ReplaceAction( pNewAction, i ); - pAction->Delete(); + MetaAction* pDeleteAction = aMtf.ReplaceAction( pNewAction, i ); + if(pDeleteAction) + pDeleteAction->Delete(); break; } default: diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx index ecefb90..4e7f38e 100644 --- a/vcl/inc/vcl/gdimtf.hxx +++ b/vcl/inc/vcl/gdimtf.hxx @@ -199,6 +199,9 @@ public: MetaAction* NextAction(); MetaAction* GetAction( size_t nAction ) const; MetaAction* GetCurAction() const { return GetAction( nCurrentActionElement ); } + /** + * @param pAction takes ownership + */ MetaAction* ReplaceAction( MetaAction* pAction, size_t nAction ); const Size& GetPrefSize() const { return aPrefSize; } diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 2427d99..869f726 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -627,12 +627,13 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) // Subdivided for better quality for older usages if(1 == aInputPolyPolygon.Count()) { - rMtf.ReplaceAction( + MetaAction* pAction = rMtf.ReplaceAction( new MetaPolyLineAction( aInputPolyPolygon.GetObject(0), pPolyLineAction->GetLineInfo()), nLastPolygonAction); - pPolyLineAction->Delete(); + if(pAction) + pAction->Delete(); } } else @@ -645,11 +646,12 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) // same sub-polygon count if(pPolyPolygonAction->GetPolyPolygon().Count() == aInputPolyPolygon.Count()) { - rMtf.ReplaceAction( + MetaAction* pAction = rMtf.ReplaceAction( new MetaPolyPolygonAction( aInputPolyPolygon), nLastPolygonAction); - pPolyPolygonAction->Delete(); + if(pAction) + pAction->Delete(); } } else @@ -661,11 +663,12 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) // replace MetaPolygonAction if(1 == aInputPolyPolygon.Count()) { - rMtf.ReplaceAction( + MetaAction* pAction = rMtf.ReplaceAction( new MetaPolygonAction( aInputPolyPolygon.GetObject(0)), nLastPolygonAction); - pPolygonAction->Delete(); + if(pAction) + pAction->Delete(); } } } diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index a1d2c36..ab53ac8 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -210,7 +210,12 @@ MetaAction* GDIMetaFile::NextAction() MetaAction* GDIMetaFile::ReplaceAction( MetaAction* pAction, size_t nAction ) { if ( nAction >= aList.size() ) + { + // this method takes ownership of pAction and is + // therefore responsible for deleting it + pAction->Delete(); return NULL; + } //fdo#39995 This does't increment the incoming action ref-count nor does it //decrement the outgoing action ref-count std::swap(pAction, aList[nAction]); commit aed9755db3de7b53cdf227c7cbcb782568649fac Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Mar 2 03:04:05 2013 +0100 coverity#736569: fix memory leak Change-Id: I57e187b41e7ed0e8c10a791af23ef22a4acb7df8 diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index dccb5fa..882ae05 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -1117,7 +1117,10 @@ bool Bitmap::ImplSeparableBlurFilter(const double radius) delete[] pCount; if ( !bResult ) + { + delete[] pBlurVector; return bResult; + } // Swap current bitmap with new bitmap ImplAssignWithSize( aNewBitmap ); commit 290451b92aa2725b43380b9d4cfea54ddb90ff33 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Mar 2 02:53:46 2013 +0100 coverity#736322: fix memory leak Change-Id: I63037b8f128ed9249580cabfe9aab898ead0f89d diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 9c25914..8cb338c 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -2156,10 +2156,7 @@ VectorOfNodes OfaTreeOptionsDialog::LoadNodes( } } else - pNode->m_aLeaves.push_back( - new OptionsLeaf( - sId, sLeafLabel, sLeafURL, - sEventHdl, sLeafGrpId, nLeafGrpIdx ) ); + pNode->m_aLeaves.push_back( pLeaf ); } } } commit a0e717596dbee0e79e481b1be9f09154331d7914 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Mar 2 02:38:19 2013 +0100 coverity#736939: swapped arguments Change-Id: I66f44ba02855cb9e1f9a986b6f60aa9710e117bd diff --git a/chart2/source/controller/dialogs/res_BarGeometry.cxx b/chart2/source/controller/dialogs/res_BarGeometry.cxx index 303f219..791b9c8 100644 --- a/chart2/source/controller/dialogs/res_BarGeometry.cxx +++ b/chart2/source/controller/dialogs/res_BarGeometry.cxx @@ -60,7 +60,7 @@ Size BarGeometryResources::GetSizePixel() const if( nWidth < m_aFT_Geometry.GetSizePixel().Width() ) nWidth = m_aFT_Geometry.GetSizePixel().Width(); - return Size( nHeight, nWidth ); + return Size( nWidth, nHeight ); } BarGeometryResources::~BarGeometryResources() { commit 9a05a482b0d695a663ec4ca14e1ee43b839f78b2 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Mar 2 02:22:04 2013 +0100 coverity#704453: new[] vs delete mismatch Change-Id: Idf32727e40605ab00c0423f57dbbcd744e898f7c diff --git a/sw/source/filter/ww1/w1class.cxx b/sw/source/filter/ww1/w1class.cxx index e39e8d3..38b744b 100644 --- a/sw/source/filter/ww1/w1class.cxx +++ b/sw/source/filter/ww1/w1class.cxx @@ -458,7 +458,7 @@ Ww1Sprm::Ww1Sprm(SvStream& rStream, sal_uLong ulFilePos) Ww1Sprm::~Ww1Sprm() { - delete pArr; + delete[] pArr; delete p; } @@ -532,7 +532,7 @@ sal_Bool Ww1Sprm::Fill(sal_uInt16 index, sal_uInt8& nId, sal_uInt16& nL, sal_uIn sal_Bool Ww1Sprm::ReCalc() { sal_Bool bRet = sal_True; - delete pArr; + delete[] pArr; pArr = NULL; count = 0; if (nCountBytes != 255) // not unused? _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits