Commit 40930508 by panda

index: Initialize case_sorted to GIT_VECTOR_INIT

This is for extra safety within write_entries
parent 21981f28
......@@ -2861,7 +2861,7 @@ static int write_entries(git_index *index, git_filebuf *file)
{
int error = 0;
size_t i;
git_vector case_sorted, *entries;
git_vector case_sorted = GIT_VECTOR_INIT, *entries = NULL;
git_index_entry *entry;
const char *last = NULL;
......@@ -2869,7 +2869,7 @@ static int write_entries(git_index *index, git_filebuf *file)
* to re-sort it case-sensitively before writing */
if (index->ignore_case) {
if ((error = git_vector_dup(&case_sorted, &index->entries, git_index_entry_cmp)) < 0)
return error;
goto done;
git_vector_sort(&case_sorted);
entries = &case_sorted;
......@@ -2887,9 +2887,8 @@ static int write_entries(git_index *index, git_filebuf *file)
last = entry->path;
}
if (index->ignore_case)
git_vector_free(&case_sorted);
done:
git_vector_free(&case_sorted);
return error;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment