summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-07-19 16:02:30 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-07-19 16:02:30 -0400
commit31e84edb14327050ba74bf213c5b17451cca311e (patch)
tree14a649035a93fac5252e591e3b6180f16102fc56
parent419ffdde6aa3c4dce60c0ab219d0ca48eaea8f81 (diff)
downloadlibgit2-31e84edb14327050ba74bf213c5b17451cca311e.tar.gz
merge: don't try to malloc(0)
-rw-r--r--src/merge.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/merge.c b/src/merge.c
index 82b028b4a..c29b40e23 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -1535,7 +1535,8 @@ int git_merge_diff_list__find_renames(
GIT_ASSERT_ARG(diff_list);
GIT_ASSERT_ARG(opts);
- if ((opts->flags & GIT_MERGE_FIND_RENAMES) == 0)
+ if ((opts->flags & GIT_MERGE_FIND_RENAMES) == 0 ||
+ !diff_list->conflicts.length)
return 0;
similarity_ours = git__calloc(diff_list->conflicts.length,