On Thu, 28 Jan 2021 08:25:03 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:
>> The function AllocateSpaceForGP in freetypeScaler.c calls potentially 2 >> times malloc ; however the memory is not always freed correctly in case of >> errors. >> See also the related sonar issue : >> https://sonarcloud.io/project/issues?id=shipilev_jdk&languages=c&open=AXck8B_SBBG2CXpcngxr&resolved=false&severities=BLOCKER&types=BUG > > Matthias Baesken has updated the pull request incrementally with one > additional commit since the last revision: > > JDK-8260426 Hi Matthias, looks fine. See remark below, but that is just nitpicking, this is fine as it is. Cheers, Thomas src/java.desktop/share/native/libfontmanager/freetypeScaler.c line 1297: > 1295: gpdata->pointCoords = NULL; > 1296: } > 1297: return 0; If you wanted, you could streamline this to: if (gpdata->pointTypes == NULL || gpdata->pointCoords == NULL) { free(gpdata->pointTypes); free(gpdata->pointCoords); gpdata->pointTypes = gpdata->pointCoords = NULL; return 0; Since free(NULL) is valid and a noop. ------------- Marked as reviewed by stuefe (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/2250