[CHG] Make sure a NULL pointer is not free'd

This commit is contained in:
Crayon2000 2009-08-26 01:59:16 +00:00
parent c8abda9052
commit 34a1991cd9
2 changed files with 10 additions and 10 deletions

View file

@ -165,6 +165,6 @@ void GRRLIB_Exit (void) {
// Free up memory allocated for frame buffers & FIFOs
if (xfb[0] != NULL) { free(MEM_K1_TO_K0(xfb[0])); xfb[0] = NULL; }
if (xfb[1] != NULL) { free(MEM_K1_TO_K0(xfb[1])); xfb[0] = NULL; }
if (xfb[1] != NULL) { free(MEM_K1_TO_K0(xfb[1])); xfb[1] = NULL; }
if (gp_fifo != NULL) { free(gp_fifo); gp_fifo = NULL; }
}

View file

@ -73,20 +73,20 @@ void GRRLIB_FlushTex (GRRLIB_texImg *tex) {
*/
INLINE
void GRRLIB_FreeTexture (GRRLIB_texImg *tex) {
if(tex != NULL) {
free(tex->data);
free(tex);
tex = NULL;
}
}
//==============================================================================
/**
* Clear a texture to transparent black
* @param tex : Texture to clear
* Clear a texture to transparent black.
* @param tex Texture to clear.
*/
//==============================================================================
INLINE
void GRRLIB_ClearTex(GRRLIB_texImg* tex)
{
bzero(tex->data, (tex->h *tex->w) <<2);
bzero(tex->data, (tex->h * tex->w) << 2);
GRRLIB_FlushTex(tex);
}