]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: contrib/mod_defender: close the va_list argp before return
authorDragan Dosen <ddosen@haproxy.com>
Mon, 18 Sep 2017 06:20:33 +0000 (08:20 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 Sep 2017 09:18:09 +0000 (11:18 +0200)
Fix the case when the va_list argp could be left open if the function
vsnprintf() returned a negative value.

contrib/mod_defender/defender.c

index c86d25e0a82b62b0fb158fab20a603d30b83a327..17341760c6314cb093fb0aafec22e59c29094b54 100644 (file)
@@ -149,9 +149,10 @@ static char *defender_printf(apr_pool_t *pool, const char *fmt, ...)
 
        va_start(argp, fmt);
        len = vsnprintf(NULL, 0, fmt, argp);
+       va_end(argp);
+
        if (len < 0)
                return NULL;
-       va_end(argp);
 
        if (!(dst = apr_pcalloc(pool, len + 1)))
                return NULL;