RFR: 8266187: Memory leak in appendBootClassPath()

Wang Huang whuang at openjdk.java.net
Wed Apr 28 06:53:18 UTC 2021


Dear All, 
    I find a memory leak in `appendBootClassPath()`
https://github.com/openjdk/jdk/blob/75a2354dc276e107d64516d20fc72bc7ef3d5f86/src/java.instrument/share/native/libinstrument/InvocationAdapter.c#L950
   we malloc `resolved` from resolve(parent, path)
* we use `resolved` in line 951 
* we don't free() this memory after using.

I think we can fix this bug by adding a free() after line 951 as my commit.
Thank you for your review. Any suggestion is welcome.

Yours , 
Wang Huang

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

Commit messages:
 - 8266187: Memory leak in appendBootClassPath()

Changes: https://git.openjdk.java.net/jdk/pull/3751/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3751&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8266187
  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3751.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3751/head:pull/3751

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


More information about the serviceability-dev mailing list