Commit 25100d6dc964cfb54d38d43a6d3bceae34dcbe36

Etienne Samson 2018-04-19T19:17:07

tests: free the worktree in add_with_explicit_branch Valgrind log: ==2711== 305 (48 direct, 257 indirect) bytes in 1 blocks are definitely lost in loss record 576 of 624 ==2711== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2711== by 0x5E079E: git__calloc (util.h:99) ==2711== by 0x5E0D21: open_worktree_dir (worktree.c:134) ==2711== by 0x5E0F23: git_worktree_lookup (worktree.c:176) ==2711== by 0x5E1972: git_worktree_add (worktree.c:388) ==2711== by 0x551F23: test_worktree_worktree__add_with_explicit_branch (worktree.c:292) ==2711== by 0x45853E: clar_run_test (clar.c:222) ==2711== by 0x4587E1: clar_run_suite (clar.c:286) ==2711== by 0x458B04: clar_parse_args (clar.c:362) ==2711== by 0x458CAB: clar_test_run (clar.c:428) ==2711== by 0x45665C: main (main.c:24)

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/tests/worktree/worktree.c b/tests/worktree/worktree.c
index 9b932d8..c79d97f 100644
--- a/tests/worktree/worktree.c
+++ b/tests/worktree/worktree.c
@@ -300,6 +300,7 @@ void test_worktree_worktree__add_with_explicit_branch(void)
 	git_reference_free(branch);
 	git_reference_free(wthead);
 	git_repository_free(wtrepo);
+	git_worktree_free(wt);
 }