Skip to content

Vector elements should be freed using myvector.erase() #643

Open
@jesshowe

Description

@jesshowe

delete this->eclipseOutMsgs.at(c);

Hi, according to documentation here, vector's erase() function should be used to remove an item from the vector and subsequently destroy it. We've run into problems where the vector still tracked a previously freed item and then tried to free it again, causing a segfault.

Also, this applies to all modules (I just included the above as an example case), and we implemented our fix like this:
this->eclipseOutMsgs.erase(this->eclipseOutMsgs.begin()+c);

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