RFR: 6478546: FileInputStream.read() throws OutOfMemoryError when there is plenty available [v2]

Sergey Tsypanov stsypanov at openjdk.org
Thu Jul 27 16:37:52 UTC 2023


On Thu, 27 Jul 2023 15:54:30 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/share/native/libjava/io_util.c line 199:
>> 
>>> 197:     }
>>> 198: 
>>> 199:     if (buf != stackBuf)
>> 
>> Wouldn't this cause a leak when if-condition is not met and `free(buf)` is not called?
>
> I don't see how this is possible. The value of `buf` is either `stackBuf` or a value returned by `malloc()`. In any case, this code will be superseded.

Then I guess we don't need this `if`-clause

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14981#discussion_r1276544537


More information about the security-dev mailing list