Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4031

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/31/4031/1

Robustify and fix leak in NBOTypeMgrBase::ImplLoad().

The >>operator of SvStream doesn't initialize a variable if the stream
is faulty. So initialize the variables before usage. Also delete the
SvStream even if it was faulty.

Change-Id: I5a7f31016e060c3b9fb4f0fd1889f444877cb89d
---
M svx/source/sidebar/nbdtmg.cxx
1 file changed, 3 insertions(+), 3 deletions(-)



diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 0976150..a1eb0c1 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -184,8 +184,8 @@
     aFile.Append( filename);
     SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( 
INetURLObject::NO_DECODE ), STREAM_READ );
     if( pIStm ) {
-        sal_uInt32                      nVersion;
-        sal_Int32                   nNumIndex;
+        sal_uInt32                  nVersion = 0;
+        sal_Int32                   nNumIndex = 0;
         *pIStm >> nVersion;
         if (nVersion==DEFAULT_NUMBERING_CACHE_FORMAT_VERSION) //first version
         {
@@ -209,8 +209,8 @@
                 RelplaceNumRule(aNum,nNumIndex,mLevel);
                 *pIStm >> nNumIndex;
             }
-            delete pIStm;
         }
+        delete pIStm;
     }
     eCoreUnit = eOldCoreUnit;
     bIsLoading = false;

-- 
To view, visit https://gerrit.libreoffice.org/4031
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a7f31016e060c3b9fb4f0fd1889f444877cb89d
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Mark Wielaard <mark@klomp.org>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.