]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t-strvec: use va_end() to match va_start()
authorJeff King <peff@peff.net>
Thu, 30 May 2024 06:39:32 +0000 (02:39 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 May 2024 15:55:29 +0000 (08:55 -0700)
Our check_strvec_loc() helper uses a variable argument list. When we
va_start(), we must be sure to va_end() before leaving the function.
This is required by the standard (though the effect of forgetting will
vary between platforms).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/unit-tests/t-strvec.c

index f17fb10d9e57105ca1b75ad0f9f0d023b0117a4c..6c1465ee610fff3b76c3e613090872e1f36bf39d 100644 (file)
@@ -22,11 +22,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);