RFR: 8256256: UL should not use heap allocation for output string [v2]

Yumin Qi minqi at openjdk.java.net
Tue Dec 1 05:34:56 UTC 2020


On Tue, 1 Dec 2020 04:43:58 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/logging/logTagSet.cpp line 129:
>> 
>>> 127:   if ((size_t)ret >= sizeof(buf)) {
>>> 128:     size_t newbuf_len = prefix_len + ret + 1;
>>> 129:     char* newbuf = (char*)::calloc(newbuf_len, sizeof(char));
>> 
>> Do we need to zero the array with calloc?
>> The `(char*)` cast shouldn't be needed.
>
> The calloc query has not been addressed.

malloc/calloc return void* so need this cast.

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

PR: https://git.openjdk.java.net/jdk/pull/1246


More information about the hotspot-runtime-dev mailing list