Commit 782402c271d5467f9890af8e808af938a93bc55f

Patrick Steinhardt 2018-01-12T13:09:23

tests: refs::iterator: fix memory leak due to ref names not being free'd The test refs::iterator::foreach_name iterates through every reference and copies its name into a local vector. While the test makes sure to free the vector afterwards, the copied reference names are not being free'd. Fix that.

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/tests/refs/iterator.c b/tests/refs/iterator.c
index 56f6ce5..18e9d1d 100644
--- a/tests/refs/iterator.c
+++ b/tests/refs/iterator.c
@@ -213,6 +213,7 @@ void test_refs_iterator__foreach_name(void)
 	git_vector_foreach(&output, i, name) {
 		cl_assert(refnames[i] != NULL);
 		cl_assert_equal_s(refnames[i], name);
+		git__free(name);
 	}
 
 	git_vector_free(&output);