Browse Source

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 <david@gibson.dropbear.id.au>
David Gibson 8 years ago
parent
commit
979071e858
3 changed files with 3 additions and 1 deletions
  1. 1 1
      ccan/failtest/failtest.c
  2. 1 0
      tools/ccanlint/file_analysis.c
  3. 1 0
      tools/gcov.c

+ 1 - 1
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)

+ 1 - 0
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;
 }
 

+ 1 - 0
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;
 }