Skip to content

Runtime-crash when using EnableMemoryLeakReportingUsesQualifiedClassName #88

@AtlasHackert

Description

@AtlasHackert

I'm on Delphi 7, and I'm getting a runtime-crash on exit when there's a memory leak if EnableMemoryLeakReportingUsesQualifiedClassName has been enabled. The problem is the following line in the AppendClassNameToBuffer function:
UnitName := @PClassData(PByte(LClassInfo) + 2 + PByte(PByte(LClassInfo) + 1)^).UnitName;

Due to either Delphi 7 or my project settings, the pointer arithmetic fails, probably raising an exception that tries to allocate memory, resulting in an invalid operation because the MM has already been uninstalled.

I fixed it by changing the line to:
UnitName := @PClassData(PByte(LClassInfo) + 2 + Integer(PByte(PByte(LClassInfo) + 1)^)).UnitName;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions