A function starts reading its variable arguments with va_start or va_copy but never calls va_end

tx0/c:va-start-without-endrecommendedwarningreliability/memory-safetydepth fastbug

What it finds

Every va_start and va_copy needs a va_end in the same function before it returns; without it the behaviour is undefined, and on some platforms memory or registers saved for the list are not released.

From the rule's source, va_start_without_end.rs.

Example from the rule's tests
#include <stdarg.h> int sum(int n, ...){  va_list ap;  va_start(ap, n);tx0 reports: va_start has no va_end in this function  int total = 0;  for (int i = 0; i < n; i++)    total += va_arg(ap, int);  return total;}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/c:va-start-without-end" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/c:va-start-without-end] reason="..."

tx0 explain tx0/c:va-start-without-end shows the same in the terminal. Found a false positive? Report it.