Skip to content

Commit

Permalink
Fixed|libappfw|ChildWidgetOrganizer: Potential memory access issue
Browse files Browse the repository at this point in the history
Issue found by Guard Malloc. Since we have an iterator already, it
is better to use it to remove the map entry rather than looking it
up again using the key.
  • Loading branch information
skyjake committed Nov 2, 2014
1 parent 557ff2a commit 5668322
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doomsday/libappfw/src/childwidgetorganizer.cpp
Expand Up @@ -179,12 +179,12 @@ DENG2_OBSERVES(ui::Item, Change )

void dataItemRemoved(ui::Data::Pos, ui::Item &item)
{
Mapping::const_iterator found = mapping.constFind(&item);
Mapping::iterator found = mapping.find(&item);
if(found != mapping.constEnd())
{
found.key()->audienceForChange() -= this;
deleteWidget(found.value());
mapping.remove(found.key());
mapping.erase(found);
}
}

Expand Down

0 comments on commit 5668322

Please sign in to comment.