RFR: 8316975: Memory leak in MTLSurfaceData
Jayathirth D V
jdv at openjdk.org
Tue Oct 10 12:11:47 UTC 2023
In MTLSurfaceData_initOps() we return if "(gc == NULL)" but we don't free already allocated "mtlsdo" using (MTLSDOps *)malloc(sizeof(MTLSDOps)) which is of 40 bytes.
We need to free(mtlsdo) before we return from MTLSurfaceData_initOps() for any reasons. Moved (mtlsdo == NULL) check right after we allocate it and added logic to delete mtlsdo(40 bytes) at appropriate places.
There is no regression test because to reproduce this issue we need to exhaust system memory.
-------------
Commit messages:
- 8316975: Memory leak in MTLSurfaceData
Changes: https://git.openjdk.org/jdk/pull/16117/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16117&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8316975
Stats: 12 lines in 1 file changed: 5 ins; 5 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/16117.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/16117/head:pull/16117
PR: https://git.openjdk.org/jdk/pull/16117
More information about the client-libs-dev
mailing list