[Libreoffice-commits] core.git: 6 commits - basic/source framework/source rsc/source sc/source sd/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Mar 9 10:02:14 PST 2013


 basic/source/comp/exprtree.cxx        |    1 +
 framework/source/services/license.cxx |   13 ++++++-------
 rsc/source/parser/rscyacc.y           |   11 +++++++----
 sc/source/ui/drawfunc/mediash.cxx     |    4 +---
 sd/source/ui/dlg/dlgass.cxx           |    4 ++--
 5 files changed, 17 insertions(+), 16 deletions(-)

New commits:
commit 5f606b0a5bcf71e7584403c9582188f1f564c67c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Mar 9 17:19:01 2013 +0100

    coverity#705676: fix memory leak
    
    Change-Id: Ibae1a0d073249ecfbfee0f73473d66bbf2602aff

diff --git a/rsc/source/parser/rscyacc.y b/rsc/source/parser/rscyacc.y
index 4fbf0fd..d0be59e 100644
--- a/rsc/source/parser/rscyacc.y
+++ b/rsc/source/parser/rscyacc.y
@@ -178,14 +178,17 @@ sal_Bool DoClassHeader( RSCHEADER * pHeader, sal_Bool bMember )
             else
                 S.Push( pHeader->pClass->Create( NULL, RSCINST() ) );
 
-            ObjNode * pNode = new ObjNode( aName1, S.Top().pData,
-                                           pFI->GetFileIndex() );
             pTC->pEH->StdOut( ".", RscVerbosityVerbose );
 
             if( !aName1.IsId() )
                 pTC->pEH->Error( ERR_IDEXPECTED, pHeader->pClass, aName1 );
-            else if( !pHeader->pClass->PutObjNode( pNode ) )
-                pTC->pEH->Error( ERR_DOUBLEID, pHeader->pClass, aName1 );
+            else
+            {
+                ObjNode * pNode = new ObjNode( aName1, S.Top().pData,
+                                               pFI->GetFileIndex() );
+                if( !pHeader->pClass->PutObjNode( pNode ) )
+                    pTC->pEH->Error( ERR_DOUBLEID, pHeader->pClass, aName1 );
+            }
         }
         else
         {
commit 7657115dd98b0583852476d75e8676d1ff631014
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Mar 9 16:32:30 2013 +0100

    coverity#705655: fix memory leak
    
    Change-Id: Icf514d2f7cf678cb347c2e114f01ae8f56e2e999

diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx
index 31057a9..41db42b 100644
--- a/framework/source/services/license.cxx
+++ b/framework/source/services/license.cxx
@@ -292,8 +292,8 @@ css::uno::Any SAL_CALL License::execute(const css::uno::Sequence< css::beans::Na
         }
         // prepare to show
         // display license dialog
-        ResMgr* pResMgr = ResMgr::SearchCreateResMgr("fwe", aLocale);
-        boost::scoped_ptr<LicenseDialog> pDialog(new LicenseDialog(aLicensePath, pResMgr));
+        boost::scoped_ptr<ResMgr> pResMgr(ResMgr::SearchCreateResMgr("fwe", aLocale));
+        boost::scoped_ptr<LicenseDialog> pDialog(new LicenseDialog(aLicensePath, pResMgr.get()));
         sal_Bool bAgreed = (pDialog->Execute() == 1);
 
         if (bAgreed) {
commit 9a4f558d00448110abed4f705989b0112a309fd8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Mar 9 16:29:18 2013 +0100

    simplify code a bit
    
    Change-Id: Id965dd79ab8401a2ba7eb8266bba642f80cbe0d3

diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx
index 7ab3502..31057a9 100644
--- a/framework/source/services/license.cxx
+++ b/framework/source/services/license.cxx
@@ -49,6 +49,8 @@
 #include <tools/datetime.hxx>
 #include <osl/time.h>
 
+#include <boost/scoped_ptr.hpp>
+
 namespace framework{
 using namespace utl;
 using namespace ::osl                           ;
@@ -219,13 +221,10 @@ css::uno::Any SAL_CALL License::execute(const css::uno::Sequence< css::beans::Na
             return aRet;
         }
         // determine the filename of the license to show
-        ::rtl::OUString  aLangString;
-        ::com::sun::star::lang::Locale aLocale;
         AllSettings aSettings(Application::GetSettings());
-        aLocale = aSettings.GetUILanguageTag().getLocale();
-        ResMgr* pResMgr = ResMgr::SearchCreateResMgr("fwe", aLocale);
+        ::com::sun::star::lang::Locale aLocale = aSettings.GetUILanguageTag().getLocale();
 
-        aLangString = aLocale.Language;
+        OUString aLangString = aLocale.Language;
         if ( !aLocale.Country.isEmpty() )
         {
             aLangString += ::rtl::OUString("-");
@@ -293,9 +292,9 @@ css::uno::Any SAL_CALL License::execute(const css::uno::Sequence< css::beans::Na
         }
         // prepare to show
         // display license dialog
-        LicenseDialog* pDialog = new LicenseDialog(aLicensePath, pResMgr);
+        ResMgr* pResMgr = ResMgr::SearchCreateResMgr("fwe", aLocale);
+        boost::scoped_ptr<LicenseDialog> pDialog(new LicenseDialog(aLicensePath, pResMgr));
         sal_Bool bAgreed = (pDialog->Execute() == 1);
-        delete pDialog;
 
         if (bAgreed) {
 
commit ead0a6038b2eab1604ca53197e6728fb4ce9dc9c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Mar 9 16:15:55 2013 +0100

    coverity#705627: fix memory leak
    
    Change-Id: I4f73f77b27d2ed28a9f97757105c8a6cc5521b33

diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index da77346..fe5077b 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -304,6 +304,7 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
         if( pConst )
         {
             delete pPar;
+            delete pvMoreParLcl;
             if( pConst->GetType() == SbxSTRING )
             {
                 return new SbiExprNode( pParser, pConst->GetString() );
commit 1b4d60268c05d7a30ce789c30597e6ae705590be
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Mar 9 16:12:14 2013 +0100

    coverity#705627: fix memory leak
    
    Change-Id: Id076550116de23aae982b15c5bf5e0b35bd9f04d

diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index c37a4ac..784a88c 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -1556,9 +1556,9 @@ void AssistentDlgImpl::UpdatePreview( sal_Bool bDocPreview )
 
         SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow);
 
-        SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
         if(IsOwnFormat(aDocFile))
         {
+            SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
             pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
             if(bDocPreview)
                 pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) );
@@ -1597,13 +1597,13 @@ void AssistentDlgImpl::UpdatePreview( sal_Bool bDocPreview )
         // load layout template
         SfxObjectShellLock xLayoutDocShell;
         SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow);
-        SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
 
         ::Window *pParent = Application::GetDefDialogParent();
         Application::SetDefDialogParent( mpWindow );
 
         if(IsOwnFormat(aLayoutFile))
         {
+            SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
             pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
             pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) );
 
commit 0973922dbfb58d3794c8645fab215ddcf9e24fc2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Mar 9 16:01:50 2013 +0100

    coverity#705689: fix memory leak
    
    Change-Id: Icdedeb1cfa50c11a640b08b930723bcbe018ebc2

diff --git a/sc/source/ui/drawfunc/mediash.cxx b/sc/source/ui/drawfunc/mediash.cxx
index 17392b1..2a4b9d7 100644
--- a/sc/source/ui/drawfunc/mediash.cxx
+++ b/sc/source/ui/drawfunc/mediash.cxx
@@ -110,7 +110,7 @@ void ScMediaShell::ExecuteMedia( SfxRequest& rReq )
 
         if( pItem )
         {
-            SdrMarkList* pMarkList = new SdrMarkList( pView->GetMarkedObjectList() );
+            boost::scoped_ptr<SdrMarkList> pMarkList(new SdrMarkList( pView->GetMarkedObjectList() ));
 
             if( 1 == pMarkList->GetMarkCount() )
             {
@@ -121,8 +121,6 @@ void ScMediaShell::ExecuteMedia( SfxRequest& rReq )
                     static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
                         static_cast< const ::avmedia::MediaItem& >( *pItem ) );
                 }
-
-                delete pMarkList;
             }
         }
     }


More information about the Libreoffice-commits mailing list