RFR: JDK-8298093: improve cleanup and error handling of awt_parseColorModel in awt_parseImage.c [v2]

Matthias Baesken mbaesken at openjdk.org
Tue Dec 6 09:55:05 UTC 2022


On Mon, 5 Dec 2022 22:01:44 GMT, Phil Race <prr at openjdk.org> wrote:

>> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   move freeing into awt_parseColorModel
>
> src/java.desktop/share/native/libawt/awt/image/awt_parseImage.c line 104:
> 
>> 102:                                       cmP)) <= 0) {
>> 103:         awt_freeParsedRaster(&imageP->raster, FALSE);
>> 104:         if (cmP->nBits != NULL) free(cmP->nBits);
> 
> It seems wrong to me that awt_parseColorModel should return a failure code and not have cleaned up any storage it itself allocated.
> In other words this clean up belongs in there.

Hi Phil, I moved the cleanup.

Another question - what do you think about introducting a macro JNU_CHECK_EXCEPTION_FREE_RETURN ? We have quite a number of places using this pattern (exception check , free and return)  , in this change now as well.  Might be worth having a macro for this.

-------------

PR: https://git.openjdk.org/jdk/pull/11508



More information about the client-libs-dev mailing list