Commit 51416b1a authored by Bas Nieuwenhuizen's avatar Bas Nieuwenhuizen Committed by Marge Bot
Browse files

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: eca6bb95

 ("util/fossilize_db: add basic fossilize db util to read/write shader caches")
Reviewed-by: Timothy Arceri's avatarTimothy Arceri <tarceri@itsqueeze.com>
Part-of: <!14671>
parent 4198ca4b
Pipeline #490973 passed with stage
in 8 minutes
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment