Free the error message in index_check. Retrieve the rowid in index_insert_file/index_prepare_for_file.