diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-03 16:11:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-03 22:01:06 +0200 |
commit | a0b549c0081f37aada8e53addf5e0b5929fb4636 (patch) | |
tree | 9acf49645b393f1f2a052ab1829029556f75cba9 | |
parent | aaeb63a9e2dcde768d6fd8d4cc8a9ad13185851b (diff) |
fix 4 separate new bugs in BitmapMosaicFilter
coverity#1435274 Dereference after null check
coverity#1435276 Resource leak
coverity#1435278 Resource leak
and on success it returned its input, throwing
away the result of its calculation
commit 63a716783a555e91ad3a32f25f20cffc88ca15e4
Author: Chris Sherlock <chris.sherlock79@gmail.com>
Date: Fri Apr 20 20:39:48 2018 +1000
vcl: ImplMosaic() -> BitmapMosaicFilter
Change-Id: Ia0910ae9166c4eb6b870ab25db761bc1703fec68
Reviewed-on: https://gerrit.libreoffice.org/53203
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Change-Id: I4eb74ef279b2ead268d07ac572ab76cd911dacb6
Reviewed-on: https://gerrit.libreoffice.org/53807
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/source/bitmap/BitmapMosaicFilter.cxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/vcl/source/bitmap/BitmapMosaicFilter.cxx b/vcl/source/bitmap/BitmapMosaicFilter.cxx index f17a25ff2283..496d687ef4e3 100644 --- a/vcl/source/bitmap/BitmapMosaicFilter.cxx +++ b/vcl/source/bitmap/BitmapMosaicFilter.cxx @@ -166,20 +166,27 @@ BitmapEx BitmapMosaicFilter::execute(BitmapEx const& rBitmapEx) Bitmap::ReleaseAccess(pReadAcc); - if (bRet) + if (pNewBmp) { - const MapMode aMap(aBitmap.GetPrefMapMode()); - const Size aPrefSize(aBitmap.GetPrefSize()); + Bitmap::ReleaseAccess(pWriteAcc); - aBitmap = *pNewBmp; + if (bRet) + { + const MapMode aMap(aBitmap.GetPrefMapMode()); + const Size aPrefSize(aBitmap.GetPrefSize()); + + aBitmap = *pNewBmp; + + aBitmap.SetPrefMapMode(aMap); + aBitmap.SetPrefSize(aPrefSize); + } - aBitmap.SetPrefMapMode(aMap); - aBitmap.SetPrefSize(aPrefSize); + delete pNewBmp; } } if (bRet) - return rBitmapEx; + return BitmapEx(aBitmap); return BitmapEx(); } |