mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-24 17:16:57 +01:00
Fixed 3 memory leakages
This commit is contained in:
parent
ccdd0779d8
commit
c224d54e1a
@ -413,7 +413,7 @@ void menu_print_font(SDL_Surface *screen, int r, int g, int b,
|
|||||||
{
|
{
|
||||||
SDL_Surface *font_surf;
|
SDL_Surface *font_surf;
|
||||||
SDL_Rect dst = {x, y, 0, 0};
|
SDL_Rect dst = {x, y, 0, 0};
|
||||||
SDL_Color color = {r, g, b};
|
SDL_Color color = {r, g, b, 0};
|
||||||
char buf[255];
|
char buf[255];
|
||||||
unsigned int i, lenght;
|
unsigned int i, lenght;
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ void print_font(SDL_Surface *screen, int r, int g, int b,
|
|||||||
#define _MAX_STRING 64
|
#define _MAX_STRING 64
|
||||||
SDL_Surface *font_surf;
|
SDL_Surface *font_surf;
|
||||||
SDL_Rect dst = {x, y, 0, 0};
|
SDL_Rect dst = {x, y, 0, 0};
|
||||||
SDL_Color color = {r, g, b};
|
SDL_Color color = {r, g, b, 0};
|
||||||
char buf[255];
|
char buf[255];
|
||||||
|
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
@ -1196,15 +1196,17 @@ static const char *menu_select_file_internal_zip(char *path,
|
|||||||
}
|
}
|
||||||
else opt = menu_select_sized("Select file", file_list, NULL, 0, x, y, x2, y2, NULL, NULL ,16, draw_scr);
|
else opt = menu_select_sized("Select file", file_list, NULL, 0, x, y, x2, y2, NULL, NULL ,16, draw_scr);
|
||||||
|
|
||||||
if (opt < 0) {free(path); return NULL;}
|
sel = NULL;
|
||||||
|
|
||||||
sel = strdup(file_list[opt]);
|
if (opt >= 0) sel = strdup(file_list[opt]);
|
||||||
|
|
||||||
/* Cleanup everything - file_list is NULL-terminated */
|
/* Cleanup everything - file_list is NULL-terminated */
|
||||||
for ( i = 0; file_list[i]; i++ )
|
for ( i = 0; file_list[i]; i++ )
|
||||||
free((void*)file_list[i]);
|
free((void*)file_list[i]);
|
||||||
free(file_list);
|
free(file_list);
|
||||||
|
|
||||||
|
if (opt < 0) {free(path); return NULL;}
|
||||||
|
|
||||||
if (!sel) {free(path); return NULL;}
|
if (!sel) {free(path); return NULL;}
|
||||||
|
|
||||||
if (opt==0||opt==1) {free(path); return sel;} //"None" or "[..]"
|
if (opt==0||opt==1) {free(path); return sel;} //"None" or "[..]"
|
||||||
@ -1282,10 +1284,10 @@ static const char *menu_select_file_internal_zip(char *path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
unzCloseCurrentFile(uf);
|
unzCloseCurrentFile(uf);
|
||||||
|
unzClose (uf);
|
||||||
free(buf2);
|
free(buf2);
|
||||||
free(sel);
|
free(sel);
|
||||||
|
|
||||||
|
|
||||||
return write_filename;
|
return write_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1364,15 +1366,18 @@ static const char *menu_select_file_internal(char *dir_path,
|
|||||||
}
|
}
|
||||||
else opt = menu_select_sized("Select file", file_list, NULL, 0, x, y, x2, y2, NULL, NULL ,16, draw_scr);
|
else opt = menu_select_sized("Select file", file_list, NULL, 0, x, y, x2, y2, NULL, NULL ,16, draw_scr);
|
||||||
|
|
||||||
if (opt < 0)
|
sel = NULL;
|
||||||
return NULL;
|
|
||||||
sel = strdup(file_list[opt]);
|
if (opt >= 0 ) sel = strdup(file_list[opt]);
|
||||||
|
|
||||||
/* Cleanup everything - file_list is NULL-terminated */
|
/* Cleanup everything - file_list is NULL-terminated */
|
||||||
for ( i = 0; file_list[i]; i++ )
|
for ( i = 0; file_list[i]; i++ )
|
||||||
free((void*)file_list[i]);
|
free((void*)file_list[i]);
|
||||||
free(file_list);
|
free(file_list);
|
||||||
|
|
||||||
|
if (opt < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (!sel)
|
if (!sel)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user