repository: fix free problem with repo_clear(the_repository)
[gitweb.git] / repository.c
index bb2fae5446b7ea8d2bfac87faa30c165f714d121..450852d9152ad791a2a63bc938e86061a55d34e2 100644 (file)
@@ -220,7 +220,8 @@ void repo_clear(struct repository *repo)
 
        if (repo->index) {
                discard_index(repo->index);
-               FREE_AND_NULL(repo->index);
+               if (repo->index != &the_index)
+                       FREE_AND_NULL(repo->index);
        }
 }