<AWT Dev> RFR: 8185739: Memory leak in BitmapUtil::BitmapToRgn

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Mon Nov 6 20:11:00 UTC 2017


Looks fine.

On 06/11/2017 12:01, Phil Race wrote:
> Bug: https://bugs.openjdk.java.net/browse/JDK-8185739
> Webrev: http://cr.openjdk.java.net/~prr/8185739/
> 
> The complaint in the bug is about this code  ..
> 254 if (!IS_SAFE_SIZE_MUL(width / 2 + 1, height)) {
> 255 throw std::bad_alloc();
> 
> .. potentially leaking memory allocated and stored in "buf" if the 
> exception is thrown.
> 
> This is indeed a potential leak but
> - the same location is also failing to release "hdc"
> - it is unclear why this needs to throw bad_alloc instead of returning 
> NULL as
> is happening elsewhere in this function and the only caller checks for NULL
> and can handle it.
> - There are two other return sites in the same function that may leak ..
> 
> I have updated all of these.
> 
> 
> -phil.
> 
> 


-- 
Best regards, Sergey.


More information about the awt-dev mailing list