Skip to content

Tone.cpp memory leak #1073

Open
Open
@ftg-xd

Description

@ftg-xd

Tone.cpp has a small memory leak. void Stop() set pointer pin to nullptr and clears the pointer before the destructor is called, which later attempts to delete pin. Since the pointer was already set to nullptr, the dynamically allocated mbed::DigitalOut instance is never deleted, leading to a memory leak every time a new Tone object is created.
Fixed by removing pin=0 and letting the destructor delete pin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions