RFR: JDK-8317959: Check return values of malloc in native java.base coding [v2]

Matthias Baesken mbaesken at openjdk.org
Thu Oct 12 14:16:57 UTC 2023


On Thu, 12 Oct 2023 12:00:19 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   doabort in check method in case no memory can be allocated
>
> src/java.base/windows/native/libjli/cmdtoargs.c line 327:
> 
>> 325:         // "pgmname" rest of cmdline ie. pgmname + 2 double quotes + space + cmdline from windows
>> 326:         char* cptr = (char*) malloc(strlen(argv[0]) + sizeof(char) * 3 + strlen(cmdline) + 1);
>> 327:         if (cptr == NULL) return false;
> 
> This doesn't look right, I think it has no choice but to print an error and doabort..

Hi Alan, I adjusted this part of the coding.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16160#discussion_r1356728099


More information about the nio-dev mailing list