summaryrefslogtreecommitdiff
path: root/t/unit-tests/t-strvec.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-06-10 10:30:39 -0700
committerJunio C Hamano <gitster@pobox.com>2024-06-10 10:30:39 -0700
commit5235e56ea59a014ffb999d2b4ce3ffa9c74ddce3 (patch)
treeceeec0a31c41b098f76fdd7cd5f59757edeae54d /t/unit-tests/t-strvec.c
parent718b50e3bf313d19073ad7c26107307b32dd8908 (diff)
parent64f8502b40affcb4c956c511fef7e704a88b0e25 (diff)
Merge branch 'jk/leakfixes'
Memory leaks in "git mv" has been plugged. * jk/leakfixes: mv: replace src_dir with a strvec mv: factor out empty src_dir removal mv: move src_dir cleanup to end of cmd_mv() t-strvec: mark variable-arg helper with LAST_ARG_MUST_BE_NULL t-strvec: use va_end() to match va_start()
Diffstat (limited to 't/unit-tests/t-strvec.c')
-rw-r--r--t/unit-tests/t-strvec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/t/unit-tests/t-strvec.c b/t/unit-tests/t-strvec.c
index f17fb10d9e..d4615ab06d 100644
--- a/t/unit-tests/t-strvec.c
+++ b/t/unit-tests/t-strvec.c
@@ -4,6 +4,7 @@
#define check_strvec(vec, ...) \
check_strvec_loc(TEST_LOCATION(), vec, __VA_ARGS__)
+LAST_ARG_MUST_BE_NULL
static void check_strvec_loc(const char *loc, struct strvec *vec, ...)
{
va_list ap;
@@ -22,11 +23,13 @@ static void check_strvec_loc(const char *loc, struct strvec *vec, ...)
strbuf_addf(&msg, "strvec index %"PRIuMAX, (uintmax_t) nr);
test_assert(loc, msg.buf, 0);
strbuf_release(&msg);
+ va_end(ap);
return;
}
nr++;
}
+ va_end(ap);
check_uint(vec->nr, ==, nr);
check_uint(vec->alloc, >=, nr);