Skip to content

Renamer introduces array initialization without free #198

@emwap

Description

@emwap

Synopsis

rename introduces calls to initArray, but does not insert a corresponding freeArray, which leads to a potential memory leak.

Background

Discovered in #197.

In 163e3f0 the compilation of Let constructs is changed to not initialize and free the variable bound, since doing that may lead to multiple frees of the same variable through aliasing. Instead, the variable is declared as an alias.

This change uncovered an issue in renameExp where the call to deepCopy introduces a call to initArray without a corresponding freeArray.

Solutions?

  • A crude solution is to emit an epilogue snippet in deepCopy and applying that when the let-bound variable goes out of scope.

/cc @pjonsson

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions