mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 01:20:17 +01:00
util/fossilize_db: Fix double free in error handling.
If the file ptr is not NULL then foz_destroy will also try to destroy it. Fixes:eca6bb9540("util/fossilize_db: add basic fossilize db util to read/write shader caches") Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14671> (cherry picked from commit51416b1a12)
This commit is contained in:
parent
2143a663da
commit
f15d2c8d3a
2 changed files with 6 additions and 2 deletions
|
|
@ -931,7 +931,7 @@
|
|||
"description": "util/fossilize_db: Fix double free in error handling.",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "eca6bb9540d8d1b260511cd0a71bdddb00ff4a3c"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -318,8 +318,12 @@ foz_prepare(struct foz_db *foz_db, char *cache_path)
|
|||
free(filename);
|
||||
free(idx_filename);
|
||||
|
||||
if (!check_files_opened_successfully(foz_db->file[file_idx], db_idx))
|
||||
if (!check_files_opened_successfully(foz_db->file[file_idx], db_idx)) {
|
||||
/* Prevent foz_destroy from destroying it a second time. */
|
||||
foz_db->file[file_idx] = NULL;
|
||||
|
||||
continue; /* Ignore invalid user provided filename and continue */
|
||||
}
|
||||
|
||||
if (!load_foz_dbs(foz_db, db_idx, file_idx, true)) {
|
||||
fclose(db_idx);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue