mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-10 21:55:11 +01:00
Fix double free
This commit is contained in:
parent
79acb2e1e9
commit
55b605b146
@ -52,7 +52,11 @@ GameInfo::GameInfo(GameInfo *gi)
|
||||
|
||||
GameInfo::~GameInfo()
|
||||
{
|
||||
this->resetDefaults();
|
||||
free((void*)this->name);
|
||||
free((void*)this->author);
|
||||
free((void*)this->filename);
|
||||
|
||||
SDL_FreeSurface(this->screenshot);
|
||||
}
|
||||
|
||||
void GameInfo::resetDefaults()
|
||||
@ -64,6 +68,7 @@ void GameInfo::resetDefaults()
|
||||
|
||||
this->name = xstrdup(" ");
|
||||
this->author = xstrdup(" ");
|
||||
this->filename = xstrdup(" ");
|
||||
this->screenshot = NULL;
|
||||
}
|
||||
|
||||
@ -121,6 +126,7 @@ bool GameInfo::fromDump(struct game_info *gi)
|
||||
|
||||
this->author = xstrdup((char*)gi->data + gi->author_off);
|
||||
this->name = xstrdup((char*)gi->data + gi->name_off);
|
||||
this->filename = xstrdup(" ");
|
||||
|
||||
rw = SDL_RWFromMem(gi->data + gi->screenshot_off,
|
||||
gi->sz - gi->screenshot_off);
|
||||
|
Loading…
Reference in New Issue
Block a user