read-cache: fix index corruption with index v4
[gitweb.git] / split-index.c
index f519e60f87578386ec9b4ea764bf530be0f64836..83e39ec8d7739816188ba909a4cb9da302d48f73 100644 (file)
@@ -167,10 +167,9 @@ void merge_base_index(struct index_state *istate)
 
        ewah_free(si->delete_bitmap);
        ewah_free(si->replace_bitmap);
-       free(si->saved_cache);
+       FREE_AND_NULL(si->saved_cache);
        si->delete_bitmap  = NULL;
        si->replace_bitmap = NULL;
-       si->saved_cache    = NULL;
        si->saved_cache_nr = 0;
 }