Fix leak in index.c (cherry picked from commit 581d5492f6afdaf31a10e51187466a80ffc9f76f)
diff --git a/src/index.c b/src/index.c
index 7a8bb2c..2f46cb0 100644
--- a/src/index.c
+++ b/src/index.c
@@ -1774,7 +1774,8 @@ int git_index_conflict_add(git_index *index,
if (entries[i] && !valid_filemode(entries[i]->mode)) {
giterr_set(GITERR_INDEX, "invalid filemode for stage %d entry",
i + 1);
- return -1;
+ ret = -1;
+ goto on_error;
}
}