[Libreoffice-commits] core.git: 7 commits - filter/source helpcompiler/source i18nutil/source idl/inc idl/source sal/cppunittester sot/qa sot/source

Stephan Bergmann sbergman at redhat.com
Tue May 27 23:55:35 PDT 2014


 filter/source/graphicfilter/iras/iras.cxx |    1 -
 helpcompiler/source/HelpCompiler.cxx      |   17 +++++++++++------
 i18nutil/source/utility/casefolding.cxx   |   13 ++++++++-----
 idl/inc/types.hxx                         |    2 ++
 idl/source/objects/types.cxx              |    4 ++++
 sal/cppunittester/cppunittester.cxx       |    7 +++----
 sot/qa/cppunit/test_sot.cxx               |    2 +-
 sot/source/sdstor/stgdir.cxx              |    9 ++-------
 8 files changed, 31 insertions(+), 24 deletions(-)

New commits:
commit f961cf50a7bcdcb173aa835db7bd891841947c31
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 28 08:54:18 2014 +0200

    Fix memory leak
    
    Change-Id: Ie12862f8df701298db51ed45b5c24814a6f94def

diff --git a/idl/inc/types.hxx b/idl/inc/types.hxx
index 4b08f71..54f2c1a 100644
--- a/idl/inc/types.hxx
+++ b/idl/inc/types.hxx
@@ -173,6 +173,8 @@ public:
                         const OString& rCName, const OString& rBasicName,
                         const OString& rBasicPostfix );
 
+    virtual ~SvMetaType();
+
     SvMetaAttributeMemberList & GetAttrList() const;
     sal_uLong               GetAttrCount() const
                         {
diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx
index fbf7f35..2916b66 100644
--- a/idl/source/objects/types.cxx
+++ b/idl/source/objects/types.cxx
@@ -784,6 +784,10 @@ SvMetaType::SvMetaType( const OString& rName,
     aBasicPostfix.setString(rBasicPostfix);
 }
 
+SvMetaType::~SvMetaType() {
+    delete pAttrList;
+}
+
 void SvMetaType::Load( SvPersistStream & rStm )
 {
     SvMetaExtern::Load( rStm );
commit 1d203f2d3f45e3323530826eb5642eb52d1c1909
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 28 08:53:46 2014 +0200

    Avoid undefined signed integer overflow
    
    Change-Id: Idbb8109c36dfe1c8ed4acb8dff1a1538e386abd8

diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index 6aed09b..f4903a5 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -967,13 +967,8 @@ bool StgDirStrm::Store()
 
 void* StgDirStrm::GetEntry( sal_Int32 n, bool bDirty )
 {
-    if( n < 0 )
-        return NULL;
-
-    n *= STGENTRY_SIZE;
-    if( n >= nSize )
-        return NULL;
-    return GetPtr( n, true, bDirty );
+    return n < 0 || n >= nSize / STGENTRY_SIZE
+        ? NULL : GetPtr( n * STGENTRY_SIZE, true, bDirty );
 }
 
 // Find a dir entry.
commit 7bc008210621429835ddb75359f2268b5f66ea8f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 28 08:53:20 2014 +0200

    Fix memory leak
    
    Change-Id: Iae6c5c1590970f79f78c50e390ffd592e5be1bc6

diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx
index 7daf9ee..c97a86e 100644
--- a/sot/qa/cppunit/test_sot.cxx
+++ b/sot/qa/cppunit/test_sot.cxx
@@ -76,7 +76,7 @@ namespace
                                         pData[i - 1] == c );
             }
         }
-
+        free(pData);
         return true;
     }
 
commit ce583af68915b83cfaa0bd4f1a2f49c92767bc8e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 28 08:52:52 2014 +0200

    Avoid undefined left shift of negative value
    
    Change-Id: If4e7f6fca3f6afbbeaa79e00706be08d674e2aeb

diff --git a/i18nutil/source/utility/casefolding.cxx b/i18nutil/source/utility/casefolding.cxx
index cbe7ea9..3fb7845 100644
--- a/i18nutil/source/utility/casefolding.cxx
+++ b/i18nutil/source/utility/casefolding.cxx
@@ -79,12 +79,14 @@ Mapping& casefolding::getConditionalValue(const sal_Unicode* str, sal_Int32 pos,
 
 Mapping& casefolding::getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, Locale& aLocale, sal_uInt8 nMappingType) throw (RuntimeException)
 {
-        static Mapping dummy = { 0, 1, { 0, 0, 0 } };
-        sal_Int16 address = CaseMappingIndex[str[pos] >> 8] << 8;
+    static Mapping dummy = { 0, 1, { 0, 0, 0 } };
+    sal_Int16 address = CaseMappingIndex[str[pos] >> 8];
 
-        dummy.map[0] = str[pos];
+    dummy.map[0] = str[pos];
 
-        if (address >= 0 && (CaseMappingValue[address += (str[pos] & 0xFF)].type & nMappingType)) {
+    if (address >= 0) {
+        address = (address << 8) + (str[pos] & 0xFF);
+        if (CaseMappingValue[address].type & nMappingType) {
             sal_uInt8 type = CaseMappingValue[address].type;
             if (type & ValueTypeNotValue) {
                 if (CaseMappingValue[address].value == 0)
@@ -105,7 +107,8 @@ Mapping& casefolding::getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32
             } else
                 dummy.map[0] = CaseMappingValue[address].value;
         }
-        return dummy;
+    }
+    return dummy;
 }
 
 inline bool SAL_CALL
commit 6e7986a2fccae2d8dac7f96a8e6b852e93e2513b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 28 08:51:41 2014 +0200

    Remove unnecessary #include again
    
    Change-Id: I8086bd4859f9f89c39e4cd1a57144a51caec3876

diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx
index 4b76245..c58bd46 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -20,7 +20,6 @@
 
 #include <vcl/graph.hxx>
 #include <vcl/bmpacc.hxx>
-#include <vcl/scopedbitmapaccess.hxx>
 
 class FilterConfigItem;
 
commit 3eb7785398552e6d62e7160207be14b1ec56df24
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 28 08:51:12 2014 +0200

    Fix memory leak
    
    ...and add---most likely necessary---null check
    
    Change-Id: I3f31c20442c45ddfd98429347f5c2521597c1769

diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx
index 5795217..8c5a579 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -174,13 +174,18 @@ xmlNodePtr HelpCompiler::clone(xmlNodePtr node, const std::string& appl)
             if (strcmp((const char*)list->name, "switchinline") == 0 || strcmp((const char*)list->name, "switch") == 0)
             {
                 std::string tmp="";
-                if (strcmp((const char*)xmlGetProp(list, (xmlChar*)"select"), "sys"))
+                xmlChar * prop = xmlGetProp(list, (xmlChar*)"select");
+                if (prop != 0)
                 {
-                    tmp = gui;
-                }
-                if (strcmp((const char*)xmlGetProp(list, (xmlChar*)"select"), "appl"))
-                {
-                    tmp = appl;
+                    if (strcmp((char *)prop, "sys") == 0)
+                    {
+                        tmp = gui;
+                    }
+                    else if (strcmp((char *)prop, "appl") == 0)
+                    {
+                        tmp = appl;
+                    }
+                    xmlFree(prop);
                 }
                 if (tmp.compare("") != 0)
                 {
commit bf2e8fadd8b861e9606ab24dcd7e253d8daedd3f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 28 08:49:10 2014 +0200

    dlclose confuses LeakSanitizer
    
    ...so just do not bother unloading the protector libs again
    
    Change-Id: I33caa7beaac3b5e6c4a4836061def24fc5372b70

diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index b42bf3a..0c5a2a1 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -48,7 +48,6 @@
 #include "cppunit/portability/Stream.h"
 
 #include "boost/noncopyable.hpp"
-#include "boost/ptr_container/ptr_vector.hpp"
 #include <boost/scoped_array.hpp>
 #include "boost/static_assert.hpp"
 
@@ -273,7 +272,6 @@ SAL_IMPLEMENT_MAIN() {
 #endif
 #endif
 
-    boost::ptr_vector<osl::Module> modules;
     std::vector<CppUnit::Protector *> protectors;
     CppUnit::TestResult result;
     std::string args;
@@ -303,8 +301,9 @@ SAL_IMPLEMENT_MAIN() {
         rtl::OUString lib(getArgument(index + 1));
         rtl::OUString sym(getArgument(index + 2));
 #ifndef DISABLE_DYNLOADING
-        modules.push_back(new osl::Module(lib, SAL_LOADMODULE_GLOBAL));
-        oslGenericFunction fn = modules.back().getFunctionSymbol(sym);
+        osl::Module mod(lib, SAL_LOADMODULE_GLOBAL);
+        oslGenericFunction fn = mod.getFunctionSymbol(sym);
+        mod.release();
 #else
         oslGenericFunction fn = 0;
         if (sym == "unoexceptionprotector")


More information about the Libreoffice-commits mailing list