From 4dc87e72303dd42363597bbb1963de80fa602bff Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 21 Jun 2017 13:35:46 +0200 Subject: 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`. --- src/merge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/merge.c b/src/merge.c index 5d69d9b15..e6fa7dca7 100644 --- a/src/merge.c +++ b/src/merge.c @@ -1165,7 +1165,7 @@ static int merge_diff_mark_similarity_exact( { size_t i, j; git_merge_diff *conflict_src, *conflict_tgt; - git_oidmap *ours_deletes_by_oid, *theirs_deletes_by_oid; + git_oidmap *ours_deletes_by_oid = NULL, *theirs_deletes_by_oid = NULL; int error = 0; if (!(ours_deletes_by_oid = git_oidmap_alloc()) || -- cgit v1.2.1