Opened 4 years ago
Closed 4 years ago
[PATCH] libmythui: Prevent memory leak and dangling reference to MythUIType children
|Reported by:||Lawrence Rust <lvr@…>||Owned by:||stuartm|
|Component:||MythTV - General||Version:||Master Head|
|Severity:||medium||Keywords:||MythUIType memory leak|
Although ownership of all MythUIType objects is transferred to the parent during construction, the MythUIType destructor doesn't delete its children, resulting in a memory leak found by valgrind.
Also, because of the ownership semantics, MythUIType's dtor should be protected. This uncovers a bug in MythUIButtonList::CopyFrom? which should use the base DeleteChild? (rather than a direct delete) otherwise a dangling reference is left.
This bug and patch apply to git master, fixes/0.25 and fixes/0.24 (maybe more).
P.S. IMHO the base class XMLParseBase of MythUIType should be protected otherwise it defeats abstraction.
Change History (7)
Changed 4 years ago by Lawrence Rust <lvr@…>
comment:1 Changed 4 years ago by stuartm
comment:2 Changed 4 years ago by Lawrence Rust <lvr@…>
comment:3 Changed 4 years ago by Lawrence Rust <lvr@…>
comment:4 Changed 4 years ago by Lawrence Rust <lvr@…>
comment:5 Changed 4 years ago by beirdo
- Owner set to stuartm
- Status changed from new to assigned
comment:6 Changed 4 years ago by stuartm
- Resolution set to Invalid
- Status changed from assigned to closed