summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2013-05-24 21:24:00 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-05-24 20:37:45 +0100
commit0699c4ee199e8d18b9e3b98967b3fd4bd1ee301c (patch)
tree18beab34dcc72379ce6886537ab5600f05e84314 /svx
parent43a57daeb458fe202b42d4c36a72f9d51f2732df (diff)
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 Reviewed-on: https://gerrit.libreoffice.org/4031 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 38de05c720693a9025ea77a7ccc5f2b56dda68cb)
Diffstat (limited to 'svx')
-rw-r--r--svx/source/sidebar/nbdtmg.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 097615037955..a1eb0c1bcb5c 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -184,8 +184,8 @@ void NBOTypeMgrBase::ImplLoad(String filename)
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 @@ void NBOTypeMgrBase::ImplLoad(String filename)
RelplaceNumRule(aNum,nNumIndex,mLevel);
*pIStm >> nNumIndex;
}
- delete pIStm;
}
+ delete pIStm;
}
eCoreUnit = eOldCoreUnit;
bIsLoading = false;