]> git.ozlabs.org Git - ccan/commitdiff
Fix missing va_end()s
authorDavid Gibson <david@gibson.dropbear.id.au>
Fri, 31 Mar 2017 13:48:22 +0000 (00:48 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Fri, 31 Mar 2017 13:48:22 +0000 (00:48 +1100)
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>
ccan/failtest/failtest.c
tools/ccanlint/file_analysis.c
tools/gcov.c

index ab8e19cdb9caf60f1d8a9451e8225f874c7932e9..aab28dd43472449493297d223afafa21d4e667c2 100644 (file)
@@ -1085,8 +1085,8 @@ int failtest_open(const char *pathname,
        call.closed = false;
        if (call.flags & O_CREAT) {
                call.mode = va_arg(ap, int);
        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)
        p = add_history(FAILTEST_OPEN, true, file, line, &call);
        /* Avoid memory leak! */
        if (p == &unrecorded_call)
index d2fe2a4c1deb621cda477148fa79b4abbe582954..25e36743c51906206f1d99179b083f26a7084adf 100644 (file)
@@ -357,6 +357,7 @@ enum line_compiled get_ccan_line_pp(struct pp_conditions *cond,
        }
        ret = get_pp(cond, head);
        tal_free(head);
        }
        ret = get_pp(cond, head);
        tal_free(head);
+       va_end(ap);
        return ret;
 }
 
        return ret;
 }
 
index 79528c1b9e855b705b3986fc2c683791a624db28..bf2b61ccfdeb66a14c73f575bcbb2499159eb427 100644 (file)
@@ -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);
        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;
 }
 
        return rc;
 }