Fixed a small memory leak and possible heap corruption

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5948 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 95dc60b5da701b633e0c939ee5320c2704fcef2d
Former-commit-id: 815eb3a5e9bae2690f1971c231a57ee1efc15fff
This commit is contained in:
beaglejoe 2015-04-05 16:56:10 +00:00
parent a277b33296
commit 64a87774c0

View file

@ -426,7 +426,15 @@ DisplayMenu::DisplayMenu()
DisplayMenu::~DisplayMenu() DisplayMenu::~DisplayMenu()
{ {
int nDefColorDepths;
int* aDefColorDepths = GfScrGetDefaultColorDepths(&nDefColorDepths);
if (_aColorDepths && _aColorDepths != aDefColorDepths)
free(_aColorDepths); free(_aColorDepths);
int nDefScreenSizes;
tScreenSize* aDefScreenSizes = GfScrGetDefaultSizes(&nDefScreenSizes);
if (_aScreenSizes && _aScreenSizes != aDefScreenSizes)
free(_aScreenSizes);
} }
bool DisplayMenu::initialize(void *pPreviousMenu) bool DisplayMenu::initialize(void *pPreviousMenu)
@ -528,4 +536,5 @@ void* DisplayMenuInit(void *pPreviousMenu)
void DisplayMenuRelease(void) void DisplayMenuRelease(void)
{ {
delete PDisplayMenu; delete PDisplayMenu;
PDisplayMenu = NULL;
} }