mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
(task_database) Fix leaks when scanning zip files
This commit is contained in:
parent
b133499071
commit
3cc6e07174
@ -617,7 +617,10 @@ int zlib_parse_file_iterate(void *data, bool *returnerr, const char *file,
|
||||
*returnerr = false;
|
||||
case ZLIB_TRANSFER_DEINIT:
|
||||
if (state->handle)
|
||||
{
|
||||
state->backend->free(state->handle);
|
||||
state->handle = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -628,6 +631,16 @@ int zlib_parse_file_iterate(void *data, bool *returnerr, const char *file,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void zlib_parse_file_iterate_stop(void *data)
|
||||
{
|
||||
zlib_transfer_t *state = (zlib_transfer_t*)data;
|
||||
if (!state || !state->handle)
|
||||
return;
|
||||
|
||||
state->type = ZLIB_TRANSFER_DEINIT;
|
||||
zlib_parse_file_iterate(data, NULL, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* zlib_parse_file:
|
||||
* @file : filename path of archive
|
||||
|
@ -83,6 +83,8 @@ int zlib_parse_file_iterate(void *data, bool *returnerr,
|
||||
const char *file,
|
||||
const char *valid_exts, zlib_file_cb file_cb, void *userdata);
|
||||
|
||||
void zlib_parse_file_iterate_stop(void *data);
|
||||
|
||||
/**
|
||||
* zlib_extract_first_content_file:
|
||||
* @zip_path : filename path to ZIP archive.
|
||||
|
@ -279,7 +279,10 @@ static int database_info_iterate_playlist_zip(
|
||||
bool returnerr = true;
|
||||
#ifdef HAVE_ZLIB
|
||||
if (db_state->crc != 0)
|
||||
{
|
||||
zlib_parse_file_iterate_stop(&db->state);
|
||||
return database_info_iterate_crc_lookup(db_state, db, db_state->zip_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (zlib_parse_file_iterate(&db->state,
|
||||
|
Loading…
Reference in New Issue
Block a user