mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 13:20:43 +00:00
task_database: fix memory leak
This commit is contained in:
parent
6c1044a699
commit
c6c090052e
@ -424,6 +424,10 @@ int cue_find_track(const char *cue_path, bool first,
|
|||||||
size_t largest = 0;
|
size_t largest = 0;
|
||||||
ssize_t volatile file_size = -1;
|
ssize_t volatile file_size = -1;
|
||||||
bool is_data = false;
|
bool is_data = false;
|
||||||
|
char *cue_dir = (char*)malloc(PATH_MAX_LENGTH);
|
||||||
|
cue_dir[0] = '\0';
|
||||||
|
|
||||||
|
fill_pathname_basedir(cue_dir, cue_path, PATH_MAX_LENGTH);
|
||||||
|
|
||||||
info.type = INTFSTREAM_FILE;
|
info.type = INTFSTREAM_FILE;
|
||||||
|
|
||||||
@ -450,9 +454,6 @@ int cue_find_track(const char *cue_path, bool first,
|
|||||||
{
|
{
|
||||||
if (string_is_equal(tmp_token, "FILE"))
|
if (string_is_equal(tmp_token, "FILE"))
|
||||||
{
|
{
|
||||||
char *cue_dir = (char*)malloc(PATH_MAX_LENGTH);
|
|
||||||
cue_dir[0] = '\0';
|
|
||||||
|
|
||||||
/* Set last index to last EOF */
|
/* Set last index to last EOF */
|
||||||
if (file_size != -1) {
|
if (file_size != -1) {
|
||||||
last_index = file_size;
|
last_index = file_size;
|
||||||
@ -467,14 +468,11 @@ int cue_find_track(const char *cue_path, bool first,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fill_pathname_basedir(cue_dir, cue_path, PATH_MAX_LENGTH);
|
|
||||||
|
|
||||||
get_token(fd, tmp_token, MAX_TOKEN_LEN);
|
get_token(fd, tmp_token, MAX_TOKEN_LEN);
|
||||||
fill_pathname_join(last_file, cue_dir, tmp_token, PATH_MAX_LENGTH);
|
fill_pathname_join(last_file, cue_dir, tmp_token, PATH_MAX_LENGTH);
|
||||||
|
|
||||||
file_size = get_file_size(last_file);
|
file_size = get_file_size(last_file);
|
||||||
|
|
||||||
free(cue_dir);
|
|
||||||
get_token(fd, tmp_token, MAX_TOKEN_LEN);
|
get_token(fd, tmp_token, MAX_TOKEN_LEN);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -524,12 +522,14 @@ int cue_find_track(const char *cue_path, bool first,
|
|||||||
}
|
}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
free(cue_dir);
|
||||||
free(tmp_token);
|
free(tmp_token);
|
||||||
free(last_file);
|
free(last_file);
|
||||||
intfstream_close(fd);
|
intfstream_close(fd);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
free(cue_dir);
|
||||||
free(tmp_token);
|
free(tmp_token);
|
||||||
free(last_file);
|
free(last_file);
|
||||||
if (fd)
|
if (fd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user