vcl: save one heap alloc

Change-Id: I4557d643debbf47c10e1ccd2141f04680333a11d
Reviewed-on: https://gerrit.libreoffice.org/24685
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx
index 7f81368..26b3448 100644
--- a/vcl/source/gdi/wall.cxx
+++ b/vcl/source/gdi/wall.cxx
@@ -202,9 +202,10 @@ Wallpaper::~Wallpaper()

void Wallpaper::ImplSetCachedBitmap( BitmapEx& rBmp ) const
{
    if( mpImplWallpaper->mpCache )
        delete const_cast< ImplWallpaper* >(mpImplWallpaper.get())->mpCache;
    const_cast< ImplWallpaper* >(mpImplWallpaper.get())->mpCache = new BitmapEx( rBmp );
   if( !mpImplWallpaper->mpCache )
      const_cast< ImplWallpaper* >(mpImplWallpaper.get())->mpCache = new BitmapEx( rBmp );
   else
      *const_cast< ImplWallpaper* >(mpImplWallpaper.get())->mpCache = rBmp;
}

const BitmapEx* Wallpaper::ImplGetCachedBitmap() const