diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2022-02-27 13:16:48 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2022-02-27 14:34:25 +0100 |
commit | 794f3a07b94d134c0393b5f804b8afaca3e20e59 (patch) | |
tree | b0e6797dda6523c230a307449bdcad9c4975c076 /svx | |
parent | a59e62abbd48a9e69dcfea574a84e70bd6983015 (diff) |
cid#1500627: Resource leak
All the memory cleaning seems still useful even when nOldSize = 0
Change-Id: Ie5a9c5e5895f545b9c352dc337141116e33e7dcc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130622
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/xoutdev/_xpoly.cxx | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx index 5cdbdacc93a3..844a21f07bcc 100644 --- a/svx/source/xoutdev/_xpoly.cxx +++ b/svx/source/xoutdev/_xpoly.cxx @@ -113,22 +113,22 @@ void ImpXPolygon::Resize( sal_uInt16 nNewSize, bool bDeletePoints ) memset( pFlagAry.get(), 0, nSize ); // copy if needed - if( !nOldSize ) - return; - - if( nOldSize < nSize ) - { - memcpy( pPointAry.get(), pOldPointAry, nOldSize*sizeof( Point ) ); - memcpy( pFlagAry.get(), pOldFlagAry, nOldSize ); - } - else + if (nOldSize) { - memcpy( pPointAry.get(), pOldPointAry, nSize*sizeof( Point ) ); - memcpy( pFlagAry.get(), pOldFlagAry, nSize ); + if( nOldSize < nSize ) + { + memcpy( pPointAry.get(), pOldPointAry, nOldSize*sizeof( Point ) ); + memcpy( pFlagAry.get(), pOldFlagAry, nOldSize ); + } + else + { + memcpy( pPointAry.get(), pOldPointAry, nSize*sizeof( Point ) ); + memcpy( pFlagAry.get(), pOldFlagAry, nSize ); - // adjust number of valid points - if( nPoints > nSize ) - nPoints = nSize; + // adjust number of valid points + if( nPoints > nSize ) + nPoints = nSize; + } } if ( bDeletePoints ) { |