index: fix memory leak on error case
diff --git a/src/index.c b/src/index.c
index 63e4796..31cb27d 100644
--- a/src/index.c
+++ b/src/index.c
@@ -3008,7 +3008,7 @@ int git_index_read_index(
if (error < 0) {
giterr_set(GITERR_INDEX, "failed to insert entry");
- return error;
+ goto done;
}
if (diff <= 0) {