RFR: 8347758: modules.cpp leaks string returned from get_numbered_propert_as_sorted_string()

David Holmes dholmes at openjdk.org
Wed Jan 15 07:30:36 UTC 2025


On Wed, 15 Jan 2025 03:11:31 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> Modules::get_numbered_property_as_sorted_string() returns strings created from os::strdup(), callers should free them after uses.

It seems odd that the main logic uses resource allocated storage but then uses `os::strdup` to return the value. If all the clients end up copying the result anyway we just get unnecessary copies made, that then have to be freed.

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

PR Comment: https://git.openjdk.org/jdk/pull/23121#issuecomment-2591825482


More information about the hotspot-runtime-dev mailing list