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

Phil Race philip.race at oracle.com
Tue Nov 7 22:14:40 UTC 2017


Might as well ..

http://cr.openjdk.java.net/~prr/8185739.1

-phil.

On 11/06/2017 11:58 PM, Prasanta Sadhukhan wrote:
> Hi Phil,
>
> Since you are checking for buf value in line248 and doing cleanup, 
> shouldn't we do the same in line322 also in BlendCopy()?
>
> Regards
> Prasanta
> On 11/7/2017 1:31 AM, 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.
>>
>>
>



More information about the awt-dev mailing list