From 979071e8587d4819a7f78613b68d29e222e5db63 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Sat, 1 Apr 2017 00:48:22 +1100 Subject: [PATCH 1/1] Fix missing va_end()s This corrects several places in ccan where stdarg.h is used but there is a missing va_end(). You can get away with this on many platforms, but not all. Caught by Coverity scan. Signed-off-by: David Gibson --- ccan/failtest/failtest.c | 2 +- tools/ccanlint/file_analysis.c | 1 + tools/gcov.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ccan/failtest/failtest.c b/ccan/failtest/failtest.c index ab8e19cd..aab28dd4 100644 --- a/ccan/failtest/failtest.c +++ b/ccan/failtest/failtest.c @@ -1085,8 +1085,8 @@ int failtest_open(const char *pathname, call.closed = false; if (call.flags & O_CREAT) { call.mode = va_arg(ap, int); - va_end(ap); } + va_end(ap); p = add_history(FAILTEST_OPEN, true, file, line, &call); /* Avoid memory leak! */ if (p == &unrecorded_call) diff --git a/tools/ccanlint/file_analysis.c b/tools/ccanlint/file_analysis.c index d2fe2a4c..25e36743 100644 --- a/tools/ccanlint/file_analysis.c +++ b/tools/ccanlint/file_analysis.c @@ -357,6 +357,7 @@ enum line_compiled get_ccan_line_pp(struct pp_conditions *cond, } ret = get_pp(cond, head); tal_free(head); + va_end(ap); return ret; } diff --git a/tools/gcov.c b/tools/gcov.c index 79528c1b..bf2b61cc 100644 --- a/tools/gcov.c +++ b/tools/gcov.c @@ -27,6 +27,7 @@ bool run_gcov(const void *ctx, unsigned int *time_ms, char **output, args = tal_vfmt(ctx, fmt, ap); rc = run_command(ctx, time_ms, output, "%s %s", cmd, args); tal_free(args); + va_end(ap); return rc; } -- 2.39.2