Commit 7a02e93e02f34befa493405b6287595a0ccaef79

Vicent Marti 2015-10-27T22:42:40

merge: Plug memory leak

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/merge.c b/src/merge.c
index 29184f6..186c770 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -1726,13 +1726,13 @@ int git_merge__iterators(
 		}
 	}
 
-	if (!given_opts || !given_opts->metric)
-		git__free(opts.metric);
-
 	error = index_from_diff_list(out, diff_list,
 		(opts.tree_flags & GIT_MERGE_TREE_SKIP_REUC));
 
 done:
+	if (!given_opts || !given_opts->metric)
+		git__free(opts.metric);
+
 	git_merge_diff_list__free(diff_list);
 	git_iterator_free(empty_ancestor);
 	git_iterator_free(empty_ours);