| 2424 | } |
| 2425 | |
| 2426 | void release_index(struct index_state *istate) |
| 2427 | { |
| 2428 | /* |
| 2429 | * Cache entries in istate->cache[] should have been allocated |
| 2430 | * from the memory pool associated with this index, or from an |
| 2431 | * associated split_index. There is no need to free individual |
| 2432 | * cache entries. validate_cache_entries can detect when this |
| 2433 | * assertion does not hold. |
| 2434 | */ |
| 2435 | validate_cache_entries(istate); |
| 2436 | |
| 2437 | resolve_undo_clear_index(istate); |
| 2438 | free_name_hash(istate); |
| 2439 | cache_tree_free(&(istate->cache_tree)); |
| 2440 | free(istate->fsmonitor_last_update); |
| 2441 | free(istate->cache); |
| 2442 | discard_split_index(istate); |
| 2443 | free_untracked_cache(istate->untracked); |
| 2444 | |
| 2445 | if (istate->sparse_checkout_patterns) { |
| 2446 | clear_pattern_list(istate->sparse_checkout_patterns); |
| 2447 | FREE_AND_NULL(istate->sparse_checkout_patterns); |
| 2448 | } |
| 2449 | |
| 2450 | if (istate->ce_mem_pool) { |
| 2451 | mem_pool_discard(istate->ce_mem_pool, should_validate_cache_entries()); |
| 2452 | FREE_AND_NULL(istate->ce_mem_pool); |
| 2453 | } |
| 2454 | } |
| 2455 | |
| 2456 | void discard_index(struct index_state *istate) |
| 2457 | { |
no test coverage detected