Skip to content

Commit 782402c

Browse files
committed
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 parent 5963292 commit 782402c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/refs/iterator.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ void test_refs_iterator__foreach_name(void)
213213
git_vector_foreach(&output, i, name) {
214214
cl_assert(refnames[i] != NULL);
215215
cl_assert_equal_s(refnames[i], name);
216+
git__free(name);
216217
}
217218

218219
git_vector_free(&output);

0 commit comments

Comments
 (0)