Skip to content

Commit 4dc87e7

Browse files
committed
merge: fix potential free of uninitialized memory
The function `merge_diff_mark_similarity_exact` may error our early and, when it does so, free the `ours_deletes_by_oid` and `theirs_deletes_by_oid` variables. While the first one can never be uninitialized due to the first call actually assigning to it, the second variable can be freed without being initialized. Fix the issue by initializing both variables to `NULL`.
1 parent 40294f3 commit 4dc87e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ static int merge_diff_mark_similarity_exact(
11651165
{
11661166
size_t i, j;
11671167
git_merge_diff *conflict_src, *conflict_tgt;
1168-
git_oidmap *ours_deletes_by_oid, *theirs_deletes_by_oid;
1168+
git_oidmap *ours_deletes_by_oid = NULL, *theirs_deletes_by_oid = NULL;
11691169
int error = 0;
11701170

11711171
if (!(ours_deletes_by_oid = git_oidmap_alloc()) ||

0 commit comments

Comments
 (0)