summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2013-06-26 03:17:24 -0500
committerFridrich Strba <fridrich@documentfoundation.org>2013-06-28 09:11:49 +0000
commit344d80ee1d3829b28c18135ac4f0500d4b69aedd (patch)
tree580a1b670ea92c1a2bbcc5204bdcc3481c62ef4c
parent776de8a2394e6adecc9b46920f3e84f522b5c149 (diff)
coverity#1028110 Dereference before null check
Change-Id: Ie5fb6a0ecad185c1849f55111c17692c280d9454 Reviewed-on: https://gerrit.libreoffice.org/4531 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r--vcl/source/gdi/bitmap3.cxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 250f188d7bb2..8d5e6a453763 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1297,8 +1297,6 @@ sal_Bool Bitmap::ImplScaleSuper(
{
BitmapColor aCol0, aCol1, aColRes;
BitmapReadAccess* pAcc = AcquireReadAccess();
- long nW = pAcc->Width() ;
- long nH = pAcc->Height() ;
Bitmap aOutBmp( Size( nDstW, nDstH ), 24 );
BitmapWriteAccess* pWAcc = aOutBmp.AcquireWriteAccess();
long* pMapIX = new long[ nDstW ];
@@ -1316,6 +1314,8 @@ sal_Bool Bitmap::ImplScaleSuper(
if( pAcc && pWAcc )
{
+ long nW = pAcc->Width() ;
+ long nH = pAcc->Height() ;
const double fRevScaleX = ( nDstW > 1L ) ? ( (double) ( nW - 1 ) / ( nDstW - 1 ) ) : 0.0;
const double fRevScaleY = ( nDstH > 1L ) ? ( (double) ( nH - 1 ) / ( nDstH - 1 ) ) : 0.0;
@@ -1488,7 +1488,7 @@ sal_Bool Bitmap::ImplScaleSuper(
}
}
}
-}
+ }
else
{
if( scaleX >= fScaleThresh && scaleY >= fScaleThresh )
@@ -2075,9 +2075,14 @@ sal_Bool Bitmap::ImplScaleSuper(
delete[] pMapFX;
delete[] pMapFY;
- ReleaseAccess( pAcc );
- aOutBmp.ReleaseAccess( pWAcc );
-
+ if(pAcc)
+ {
+ ReleaseAccess( pAcc );
+ }
+ if(pWAcc)
+ {
+ aOutBmp.ReleaseAccess( pWAcc );
+ }
if( bRet )
{
ImplAdaptBitCount(aOutBmp);