Skip to content

Commit

Permalink
NWN: Avoid a possible memory leak in CharGenChoices
Browse files Browse the repository at this point in the history
  • Loading branch information
Supermanu committed May 4, 2016
1 parent 70dba7c commit 6f069ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/engines/nwn/gui/chargen/chargenchoices.cpp
Expand Up @@ -35,14 +35,15 @@ namespace Engines {

namespace NWN {

CharGenChoices::CharGenChoices() {
CharGenChoices::CharGenChoices() : _characterUsed(false) {
_creature = new Creature();

init();
}

CharGenChoices::~CharGenChoices() {
delete _creature;
if (!_characterUsed)
delete _creature;
}

void CharGenChoices::init() {
Expand Down
1 change: 1 addition & 0 deletions src/engines/nwn/gui/chargen/chargenchoices.h
Expand Up @@ -98,6 +98,7 @@ class CharGenChoices {
uint8 _domain2;

void init();
bool _characterUsed;
};

} // End of namespace NWN
Expand Down

0 comments on commit 6f069ab

Please sign in to comment.