[Libreoffice-commits] core.git: vcl/source

Caolán McNamara caolanm at redhat.com
Thu May 3 20:01:32 UTC 2018


 vcl/source/bitmap/BitmapMosaicFilter.cxx |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit a0b549c0081f37aada8e53addf5e0b5929fb4636
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 3 16:11:37 2018 +0100

    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 at 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 at libreoffice.org>
        Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    
    Change-Id: I4eb74ef279b2ead268d07ac572ab76cd911dacb6
    Reviewed-on: https://gerrit.libreoffice.org/53807
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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();
 }


More information about the Libreoffice-commits mailing list