BGA: Fix possible memory leak.

This commit is contained in:
Jonas 'Sortie' Termansen 2012-12-05 01:09:05 +01:00
parent 4d37197472
commit 3116161f5d
1 changed files with 7 additions and 1 deletions

View File

@ -303,11 +303,17 @@ bool BGADriver::SwitchMode(const char* mode)
{
bool result = false;
char* modeclone = String::Clone(mode);
if ( !modeclone )
return NULL;
char* xstr = NULL;
char* ystr = NULL;
char* bppstr = NULL;
if ( !ReadParamString(mode, "width", &xstr, "height", &ystr,
"bpp", &bppstr, "STOP") ) { return false; }
"bpp", &bppstr, "STOP") )
{
delete[] modeclone;
return false;
}
uint16_t xres = xstr ? atoi(xstr) : 0;
uint16_t yres = ystr ? atoi(ystr) : 0;
uint16_t bpp = bppstr ? atoi(bppstr) : 32;