[jdk17u-dev] Integrated: 8283469: Don't use memset to initialize members in FileMapInfo and fix memory leak

Zhengyu Gu zgu at openjdk.java.net
Wed May 18 12:39:02 UTC 2022


On Fri, 13 May 2022 14:10:39 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> I would like to backport this patch to 17u, to fix a memory leak, also eliminates dangerous memset call, could potentially result in fatal crash.
> 
> The original patch does not apply cleanly, due to [JDK-8261455](https://bugs.openjdk.java.net/browse/JDK-8261455), where it changed FileMapInfo's constructor signature to pass in full_path as a parameter. The conflict is resolved manually by initializing _full_path to nullptr.
> 
> I also bought down following code from [JDK-8261455](https://bugs.openjdk.java.net/browse/JDK-8261455), given it is a P4 enhancement, I don't see it is a candidate for backport itself. But following code obviously fixes a bug that leaves file open after use. 
> 
> ``` 
>   if (_file_open) {
>     os::close(_fd);
>   }
> 
> 
> Test:
>   - [x] hotspot_cds on Linux x86_64
>   - [x]  GHA

This pull request has now been integrated.

Changeset: 0355888e
Author:    Zhengyu Gu <zgu at openjdk.org>
URL:       https://git.openjdk.java.net/jdk17u-dev/commit/0355888e01ad50938e47be59934d25356e422e93
Stats:     13 lines in 1 file changed: 8 ins; 2 del; 3 mod

8283469: Don't use memset to initialize members in FileMapInfo and fix memory leak

Reviewed-by: mdoerr
Backport-of: d6fa8b004bcd0a2fc1015055d0177428889b4c31

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

PR: https://git.openjdk.java.net/jdk17u-dev/pull/397


More information about the jdk-updates-dev mailing list