[Fix] A few memleaks.
This commit is contained in:
parent
a0f6dec666
commit
1f3947bc49
@ -334,6 +334,7 @@ static void mission_freeData(MissionData* mission) {
|
||||
if(mission->avail.planet) free(mission->avail.planet);
|
||||
if(mission->avail.system) free(mission->avail.system);
|
||||
if(mission->avail.factions) free(mission->avail.factions);
|
||||
if(mission->avail.cond) free(mission->avail.cond);
|
||||
memset(mission, 0, sizeof(MissionData));
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,8 @@ void gl_freeTexture(glTexture* texture) {
|
||||
if(cur->used <= 0) {
|
||||
/* Not used anymore - Free the texture. */
|
||||
glDeleteTextures(1, &texture->texture);
|
||||
if(texture->trans) free(texture->trans);
|
||||
if(texture->trans != NULL) free(texture->trans);
|
||||
if(texture->name != NULL) free(texture->name);
|
||||
free(texture);
|
||||
|
||||
/* Free the list node. */
|
||||
|
@ -72,8 +72,8 @@ static int spfx_base_load(char* name, int anim, char* gfx, int sx, int sy) {
|
||||
}
|
||||
|
||||
static void spfx_base_free(SPFX_Base* effect) {
|
||||
if(effect->name) free(effect->name);
|
||||
if(effect->gfx) gl_freeTexture(effect->gfx);
|
||||
if(effect->name != NULL) free(effect->name);
|
||||
if(effect->gfx != NULL) gl_freeTexture(effect->gfx);
|
||||
}
|
||||
|
||||
int spfx_get(char* name) {
|
||||
|
@ -511,6 +511,7 @@ unsigned int window_create(char* name, const int x, const int y,
|
||||
wdw->y = SCREEN_H - windows[nwindows].h + (double)y;
|
||||
else wdw->y = (double)y;
|
||||
|
||||
/* Widgets. */
|
||||
wdw->widgets = NULL;
|
||||
wdw->nwidgets = 0;
|
||||
|
||||
@ -576,6 +577,12 @@ void window_destroy(const unsigned int wid) {
|
||||
free(windows[i].widgets);
|
||||
break;
|
||||
}
|
||||
|
||||
if(i == nwindows) { /* Not found. */
|
||||
WARN("Window of id '%u' not found in window stack!", wid);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Move the other windows down a layer. */
|
||||
for(; i<(nwindows-1); i++)
|
||||
windows[i] = windows[i+1];
|
||||
|
Loading…
Reference in New Issue
Block a user