use unique_ptr in OutputDevice::EmulateDrawTransparent

Change-Id: I45f04c49055b0bead6b966ed4e682aec70c6e7a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111402
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel 2021-02-23 15:43:30 +02:00 committed by Noel Grandin
parent ba20fcaa25
commit 6e01d697ef

View file

@ -421,7 +421,8 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
{
const BitmapPalette& rPal = pW->GetPalette();
const sal_uInt16 nCount = rPal.GetEntryCount();
BitmapColor* pMap = reinterpret_cast<BitmapColor*>(new sal_uInt8[ nCount * sizeof( BitmapColor ) ]);
std::unique_ptr<sal_uInt8[]> xMap(new sal_uInt8[ nCount * sizeof( BitmapColor )]);
BitmapColor* pMap = reinterpret_cast<BitmapColor*>(xMap.get());
for( sal_uInt16 i = 0; i < nCount; i++ )
{
@ -470,7 +471,6 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
}
}
}
delete[] reinterpret_cast<sal_uInt8*>(pMap);
}
else
{