RFR: 8316975: Memory leak in MTLSurfaceData

Phil Race prr at openjdk.org
Tue Oct 10 20:10:25 UTC 2023


On Tue, 10 Oct 2023 12:03:23 GMT, Jayathirth D V <jdv at openjdk.org> wrote:

> 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.

Marked as reviewed by prr (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/16117#pullrequestreview-1668698858


More information about the client-libs-dev mailing list