LAB: Plug a memory leak in freeButtonList()
This commit is contained in:
parent
6230fcbeb9
commit
c4ca8223b7
1 changed files with 5 additions and 2 deletions
|
@ -56,8 +56,11 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image
|
|||
}
|
||||
|
||||
void freeButtonList(GadgetList *gadgetList) {
|
||||
for (GadgetList::iterator gadget = gadgetList->begin(); gadget != gadgetList->end(); ++gadget) {
|
||||
delete *gadget;
|
||||
for (GadgetList::iterator gadgetIter = gadgetList->begin(); gadgetIter != gadgetList->end(); ++gadgetIter) {
|
||||
Gadget *gadget = *gadgetIter;
|
||||
delete gadget->_image;
|
||||
delete gadget->_altImage;
|
||||
delete gadget;
|
||||
}
|
||||
|
||||
gadgetList->clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue