Skip to content

Commit

Permalink
NWN: Fix a leak in loadEquippedItems()
Browse files Browse the repository at this point in the history
Coverity issue 1038250.
  • Loading branch information
DrMcCoy committed Jun 26, 2013
1 parent 627a3d1 commit 3e61d1e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/engines/nwn/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,12 +749,9 @@ void Creature::loadEquippedItems(const Aurora::GFFStruct &gff) {
}
}

Item *item = new Item();

item->load(cItem, uti ? &uti->getTopLevel() : 0);

// Add it to the equipped list
_equippedItems.push_back(*item);
// Load the item and add it to the equipped list
_equippedItems.push_back(Item());
_equippedItems.back().load(cItem, uti ? &uti->getTopLevel() : 0);

delete uti;
}
Expand Down

0 comments on commit 3e61d1e

Please sign in to comment.