[Libreoffice-commits] core.git: vcl/source
Caolán McNamara
caolanm at redhat.com
Thu Feb 23 09:01:00 UTC 2017
vcl/source/gdi/svmconverter.cxx | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
New commits:
commit 3a70e0f1b9613c39d97ea315d6980735022667e9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Feb 23 08:59:19 2017 +0000
ofz#663 leak in svm comment reader
Change-Id: Ia72da932d7927a143f1b3901d46d610a51fa551d
diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 06c5325..eae296f 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -1355,23 +1355,21 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
{
sal_Int32 nValue;
sal_uInt32 nDataSize;
- sal_uInt8* pData;
+ std::vector<sal_uInt8> aData;
sal_Int32 nFollowingActionCount;
OString aComment = read_uInt16_lenPrefixed_uInt8s_ToOString(rIStm);
rIStm.ReadInt32( nValue ).ReadUInt32( nDataSize );
- if( nDataSize )
+ if (nDataSize)
{
- pData = new sal_uInt8[ nDataSize ];
- rIStm.ReadBytes( pData, nDataSize );
+ aData.resize(nDataSize);
+ nDataSize = rIStm.ReadBytes(aData.data(), nDataSize);
}
- else
- pData = nullptr;
rIStm.ReadInt32( nFollowingActionCount );
ImplSkipActions( rIStm, nFollowingActionCount );
- rMtf.AddAction( new MetaCommentAction( aComment, nValue, pData, nDataSize ) );
+ rMtf.AddAction(new MetaCommentAction(aComment, nValue, aData.data(), nDataSize));
i += nFollowingActionCount;
}
More information about the Libreoffice-commits
mailing list