Skip to content

Memory leak in DisplayProperties #636

Description

@tkemmer

DisplayProperties::rep_ is used as a temporary for both owning (via [1]) and non-owning (via [2]) raw pointers, leaking memory in the first case.

[1]

rep_ = new Representation();

[2]
rep_ = *gc->getHighlightedRepresentations().begin();

Direct leak of 248 byte(s) in 1 object(s) allocated from:
    #0 0x7f44d3ac7760 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/libasan.so.3+0xc8760)
    #1 0x7f44d2e889d8 in BALL::VIEW::DisplayProperties::createRepresentation(std::__cxx11::list<BALL::Composite*, std::allocator<BALL::Composite*> > const&, bool) /home/thomas/git/apps/ball/source/VIEW/DIALOGS/displayProperties.C:526
    #2 0x7f44d2e87372 in BALL::VIEW::DisplayProperties::onNotify(BALL::VIEW::Message*) /home/thomas/git/apps/ball/source/VIEW/DIALOGS/displayProperties.C:331
    #3 0x7f44d3107a43 in BALL::VIEW::ConnectionObject::onNotify_(BALL::VIEW::Message*) /home/thomas/git/apps/ball/source/VIEW/KERNEL/connectionObject.C:225
    #4 0x7f44d3107adf in BALL::VIEW::ConnectionObject::onNotify_(BALL::VIEW::Message*) /home/thomas/git/apps/ball/source/VIEW/KERNEL/connectionObject.C:235
    #5 0x7f44d31077b4 in BALL::VIEW::ConnectionObject::notify_(BALL::VIEW::Message*) /home/thomas/git/apps/ball/source/VIEW/KERNEL/connectionObject.C:194
    #6 0x7f44d3123191 in BALL::VIEW::MainControl::insert(BALL::Composite&, BALL::String, bool) /home/thomas/git/apps/ball/source/VIEW/KERNEL/mainControl.C:1583
    #7 0x7f44d333f20f in BALL::VIEW::MolecularStructure::buildPeptide() /home/thomas/git/apps/ball/source/VIEW/WIDGETS/molecularStructure.C:1465
    #8 0x7f44d33ebe46 in BALL::VIEW::MolecularStructure::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/thomas/git/apps/ball/build/VIEW_automoc.dir/moc_molecularStruc_2SOUKAKD3JKZIA.cpp:204
    #9 0x7f44c30675f8 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2675f8)
    #10 0x7f44c8d60131 in QAction::triggered(bool) (/usr/lib64/libQt5Widgets.so.5+0x153131)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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