[Libreoffice-commits] core.git: 4 commits - cui/source l10ntools/source sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Thu Sep 5 07:29:49 PDT 2013


 cui/source/options/optaboutconfig.cxx |   12 ++++++----
 l10ntools/source/pocheck.cxx          |   40 ++++++++++++++++++++--------------
 sc/source/core/tool/chgviset.cxx      |   22 +++++++++---------
 3 files changed, 43 insertions(+), 31 deletions(-)

New commits:
commit 29858ef0f626826464f0452ec42d274742230455
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Sep 5 16:22:16 2013 +0200

    CID#1078786: fix memory leak
    
    Change-Id: I17a257f2abe90e8d489fa1af0e0889934dc3fd47

diff --git a/l10ntools/source/pocheck.cxx b/l10ntools/source/pocheck.cxx
index 9dcbe75..a7c16e4 100644
--- a/l10ntools/source/pocheck.cxx
+++ b/l10ntools/source/pocheck.cxx
@@ -33,15 +33,19 @@ static void checkStyleNames(OString aLanguage)
 
     for(;;)
     {
-        PoEntry* aPoEntry = new PoEntry();
-        aPoInput.readEntry(*aPoEntry);
+        PoEntry* pPoEntry = new PoEntry();
+        aPoInput.readEntry(*pPoEntry);
         bool bRepeated = false;
         if( aPoInput.eof() )
+        {
+            delete pPoEntry;
             break;
-        if( !aPoEntry->isFuzzy() && aPoEntry->getSourceFile() == "poolfmt.src" &&
-            aPoEntry->getGroupId().startsWith("STR_POOLCOLL") )
+        }
+
+        if( !pPoEntry->isFuzzy() && pPoEntry->getSourceFile() == "poolfmt.src" &&
+            pPoEntry->getGroupId().startsWith("STR_POOLCOLL") )
         {
-            OString aMsgStr = aPoEntry->getMsgStr();
+            OString aMsgStr = pPoEntry->getMsgStr();
             if( aMsgStr.isEmpty() )
                 continue;
             if( aLocalizedStyleNames.find(aMsgStr) == aLocalizedStyleNames.end() )
@@ -51,10 +55,10 @@ static void checkStyleNames(OString aLanguage)
                 bRepeated = true;
             }
         }
-        if( !aPoEntry->isFuzzy() && aPoEntry->getSourceFile() == "poolfmt.src" &&
-            aPoEntry->getGroupId().startsWith("STR_POOLNUMRULE") )
+        if( !pPoEntry->isFuzzy() && pPoEntry->getSourceFile() == "poolfmt.src" &&
+            pPoEntry->getGroupId().startsWith("STR_POOLNUMRULE") )
         {
-            OString aMsgStr = aPoEntry->getMsgStr();
+            OString aMsgStr = pPoEntry->getMsgStr();
             if( aMsgStr.isEmpty() )
                 continue;
             if( aLocalizedNumStyleNames.find(aMsgStr) == aLocalizedNumStyleNames.end() )
@@ -65,9 +69,9 @@ static void checkStyleNames(OString aLanguage)
             }
         }
         if (bRepeated)
-            repeatedEntries.push_back(aPoEntry);
+            repeatedEntries.push_back(pPoEntry);
          else
-            delete aPoEntry;
+            delete pPoEntry;
 
     }
     aPoInput.close();
commit 4a59b7519688e4f7662367e3b4bee01d91ade9cd
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Sep 5 16:19:45 2013 +0200

    CID#1078787: fix memory leak
    
    Change-Id: Ia54965d35ffe29e32b85cd720ecd41495ff72063

diff --git a/l10ntools/source/pocheck.cxx b/l10ntools/source/pocheck.cxx
index 10dcb19..9dcbe75 100644
--- a/l10ntools/source/pocheck.cxx
+++ b/l10ntools/source/pocheck.cxx
@@ -248,23 +248,27 @@ static void checkFunctionNames(OString aLanguage)
 
     for(;;)
     {
-        PoEntry* aPoEntry = new PoEntry();
-        aPoInput.readEntry(*aPoEntry);
+        PoEntry* pPoEntry = new PoEntry();
+        aPoInput.readEntry(*pPoEntry);
         if( aPoInput.eof() )
+        {
+            delete pPoEntry;
             break;
-        if( !aPoEntry->isFuzzy() && aPoEntry->getGroupId() == "RID_PRICING_FUNCTION_NAMES" )
+        }
+
+        if( !pPoEntry->isFuzzy() && pPoEntry->getGroupId() == "RID_PRICING_FUNCTION_NAMES" )
         {
-            OString aMsgStr = aPoEntry->getMsgStr();
+            OString aMsgStr = pPoEntry->getMsgStr();
             if( aMsgStr.isEmpty() )
                 continue;
             if( aLocalizedCoreFunctionNames.find(aMsgStr) != aLocalizedCoreFunctionNames.end() )
                 aMsgStr += "_ADD";
             if( aLocalizedFunctionNames.find(aMsgStr) == aLocalizedFunctionNames.end() ) {
                 aLocalizedFunctionNames[aMsgStr] = 1;
-                delete aPoEntry;
+                delete pPoEntry;
             } else {
                 aLocalizedFunctionNames[aMsgStr]++;
-                repeatedEntries.push_back(aPoEntry);
+                repeatedEntries.push_back(pPoEntry);
             }
         }
     }
commit 713f03d8ff946ebb2bbd8455c053d4c3e57c2ece
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Sep 5 16:10:52 2013 +0200

    CID#1078788: fix memory leak
    
    Change-Id: I4ac535c4f5dd3b414771d54ba1718ffe5254b525

diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 9084b8d..abedfed 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -386,7 +386,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
 
     //aProperty.Name = sPropertyPath + OUString("/") + sPropertyName;
 
-    Prop_Impl* aProperty = new Prop_Impl( sPropertyPath, sPropertyName, makeAny( sPropertyValue ) );
+    Prop_Impl* pProperty = new Prop_Impl( sPropertyPath, sPropertyName, makeAny( sPropertyValue ) );
 
     bool bOpenDialog;
     OUString sDialogValue;
@@ -406,7 +406,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
             bValue = true;
         }
 
-        aProperty->Value = uno::makeAny( bValue );
+        pProperty->Value = uno::makeAny( bValue );
         bOpenDialog = false;
     }else// if ( sPropertyType == OUString( "string" ) )
     {
@@ -425,12 +425,16 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
         {
             sNewValue = pValueDialog->getValue();
             //TODO: parse the value according to the type?
-            aProperty->Value = uno::makeAny( sNewValue );
-            AddToModifiedVector( aProperty );
+            pProperty->Value = uno::makeAny( sNewValue );
+            AddToModifiedVector( pProperty );
 
             sDialogValue = sNewValue;
         }
+        else
+            delete pProperty;
     }
+    else
+        delete pProperty;
 
     pPrefBox->SetEntryText( sDialogValue,  pEntry, 3 );
     //TODO:update listbox value.
commit ecfe2f64d37f9414de3a4910719b4c0edddb727d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Sep 5 15:55:20 2013 +0200

    CID#1079183: unitialized pointer value
    
    Change-Id: Ic6f01adb83f1d30bbb3630c7ae4bf1cf5ce91635

diff --git a/sc/source/core/tool/chgviset.cxx b/sc/source/core/tool/chgviset.cxx
index e924a060..163e75d 100644
--- a/sc/source/core/tool/chgviset.cxx
+++ b/sc/source/core/tool/chgviset.cxx
@@ -27,14 +27,13 @@
 // -----------------------------------------------------------------------
 ScChangeViewSettings::~ScChangeViewSettings()
 {
-    if(pCommentSearcher!=NULL)
-        delete pCommentSearcher;
+    delete pCommentSearcher;
 }
 
-ScChangeViewSettings::ScChangeViewSettings( const ScChangeViewSettings& r )
-    :
-        aFirstDateTime( DateTime::EMPTY ),
-        aLastDateTime( DateTime::EMPTY )
+ScChangeViewSettings::ScChangeViewSettings( const ScChangeViewSettings& r ):
+    pCommentSearcher(NULL),
+    aFirstDateTime( DateTime::EMPTY ),
+    aLastDateTime( DateTime::EMPTY )
 {
     SetTheComment(r.aComment);
 
@@ -59,6 +58,7 @@ ScChangeViewSettings::ScChangeViewSettings( const ScChangeViewSettings& r )
 
 ScChangeViewSettings& ScChangeViewSettings::operator=( const ScChangeViewSettings& r )
 {
+    pCommentSearcher = NULL;
     SetTheComment(r.aComment);
 
     aFirstDateTime  =r.aFirstDateTime;
@@ -83,21 +83,21 @@ ScChangeViewSettings& ScChangeViewSettings::operator=( const ScChangeViewSetting
 
 sal_Bool ScChangeViewSettings::IsValidComment(const OUString* pCommentStr) const
 {
-    sal_Bool nTheFlag=sal_True;
+    bool nTheFlag = true;
 
-    if(pCommentSearcher!=NULL)
+    if(pCommentSearcher)
     {
         sal_Int32 nStartPos = 0;
         sal_Int32 nEndPos = pCommentStr->getLength();
-        nTheFlag=pCommentSearcher->SearchForward(*pCommentStr, &nStartPos, &nEndPos);
+        nTheFlag = pCommentSearcher->SearchForward(*pCommentStr, &nStartPos, &nEndPos);
     }
     return nTheFlag;
 }
 
 void ScChangeViewSettings::SetTheComment(const OUString& rString)
 {
-    aComment=rString;
-    if(pCommentSearcher!=NULL)
+    aComment = rString;
+    if(pCommentSearcher)
     {
         delete pCommentSearcher;
         pCommentSearcher=NULL;


More information about the Libreoffice-commits mailing list