Commit f4c05192 by panda Committed by Edward Thomson

index: Check git_vector_dup error in write_entries

If allocating case_sorted.contents fails, git_vector_sort will segfault.
parent 3f56baf8
......@@ -2833,7 +2833,9 @@ static int write_entries(git_index *index, git_filebuf *file)
/* If index->entries is sorted case-insensitively, then we need
* to re-sort it case-sensitively before writing */
if (index->ignore_case) {
git_vector_dup(&case_sorted, &index->entries, git_index_entry_cmp);
if ((error = git_vector_dup(&case_sorted, &index->entries, git_index_entry_cmp)) < 0)
return error;
git_vector_sort(&case_sorted);
entries = &case_sorted;
} else {
......
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