From acf83365fcea4b8471f087cf88a548e77b4b26e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 29 Sep 2015 10:19:14 +0100 Subject: [PATCH] coverity#1325067 Resource leak Change-Id: I1db24c81a2698ff49dd2441ddd1bc94a1a3e6f58 --- vcl/source/gdi/dibtools.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index ebab16d20a16..dbd69d896a8f 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -748,8 +748,13 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon BitmapPalette aDummyPal; Bitmap aNewBmp(aSizePixel, nBitCount, &aDummyPal); BitmapWriteAccess* pAcc = aNewBmp.AcquireWriteAccess(); - if (!pAcc || pAcc->Width() != aHeader.nWidth || pAcc->Height() != aHeader.nHeight) + if (!pAcc) return false; + if (pAcc->Width() != aHeader.nWidth || pAcc->Height() != aHeader.nHeight) + { + Bitmap::ReleaseAccess(pAcc); + return false; + } Bitmap aNewBmpAlpha; BitmapWriteAccess* pAccAlpha = 0; bool bAlphaPossible(pBmpAlpha && aHeader.nBitCount == 32);