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

Zhengyu Gu zgu at openjdk.java.net
Mon May 16 12:47:56 UTC 2022


> 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

Zhengyu Gu has updated the pull request incrementally with one additional commit since the last revision:

  Added an empty line

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

Changes:
  - all: https://git.openjdk.java.net/jdk17u-dev/pull/397/files
  - new: https://git.openjdk.java.net/jdk17u-dev/pull/397/files/63f416a5..d102de92

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk17u-dev&pr=397&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk17u-dev&pr=397&range=00-01

  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk17u-dev/pull/397.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17u-dev pull/397/head:pull/397

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


More information about the jdk-updates-dev mailing list