mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
zip_support: Fix potential memory leaks
This commit is contained in:
parent
8e12c7811c
commit
f9b29de401
@ -180,8 +180,6 @@ int read_zip_file(const char * archive_path,
|
|||||||
struct string_list *compressed_zip_file_list_new(const char *path,
|
struct string_list *compressed_zip_file_list_new(const char *path,
|
||||||
const char* ext)
|
const char* ext)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
struct string_list *ext_list = NULL;
|
struct string_list *ext_list = NULL;
|
||||||
struct string_list *list = (struct string_list*)string_list_new();
|
struct string_list *list = (struct string_list*)string_list_new();
|
||||||
if (!list)
|
if (!list)
|
||||||
@ -204,6 +202,8 @@ struct string_list *compressed_zip_file_list_new(const char *path,
|
|||||||
if (!zipfile)
|
if (!zipfile)
|
||||||
{
|
{
|
||||||
RARCH_ERR("Could not open zipfile %s.\n",path);
|
RARCH_ERR("Could not open zipfile %s.\n",path);
|
||||||
|
string_list_free(list);
|
||||||
|
string_list_free(ext_list);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,6 +215,8 @@ struct string_list *compressed_zip_file_list_new(const char *path,
|
|||||||
"Could be only a gzip file without the zip part.\n",
|
"Could be only a gzip file without the zip part.\n",
|
||||||
path);
|
path);
|
||||||
unzClose( zipfile );
|
unzClose( zipfile );
|
||||||
|
string_list_free(list);
|
||||||
|
string_list_free(ext_list);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,6 +236,8 @@ struct string_list *compressed_zip_file_list_new(const char *path,
|
|||||||
{
|
{
|
||||||
RARCH_ERR("Could not read file info in zip %s.\n",path);
|
RARCH_ERR("Could not read file info in zip %s.\n",path);
|
||||||
unzClose( zipfile );
|
unzClose( zipfile );
|
||||||
|
string_list_free(list);
|
||||||
|
string_list_free(ext_list);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,6 +275,8 @@ struct string_list *compressed_zip_file_list_new(const char *path,
|
|||||||
{
|
{
|
||||||
RARCH_ERR( "Could not iterate to next file in %s. Zipfile might be corrupt.\n",path );
|
RARCH_ERR( "Could not iterate to next file in %s. Zipfile might be corrupt.\n",path );
|
||||||
unzClose( zipfile );
|
unzClose( zipfile );
|
||||||
|
string_list_free(list);
|
||||||
|
string_list_free(ext_list);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user