BUG/MINOR: contrib/modsecurity: close the va_list ap before return

Make sure the va_list ap is closed before return in case the function
vsnprintf() returned an error.
This commit is contained in:
Dragan Dosen 2017-09-18 09:20:43 +02:00 committed by Willy Tarreau
parent ccf6100e11
commit 2f1cacb1aa
1 changed files with 4 additions and 2 deletions

View File

@ -105,9 +105,10 @@ static char *printf_dup(struct request_rec *req, char *fmt, ...)
va_start(ap, fmt); va_start(ap, fmt);
len = vsnprintf(NULL, 0, fmt, ap); len = vsnprintf(NULL, 0, fmt, ap);
va_end(ap);
if (len == -1) if (len == -1)
return NULL; return NULL;
va_end(ap);
out = apr_pcalloc(req->pool, len + 1); out = apr_pcalloc(req->pool, len + 1);
if (!out) if (!out)
@ -115,9 +116,10 @@ static char *printf_dup(struct request_rec *req, char *fmt, ...)
va_start(ap, fmt); va_start(ap, fmt);
len = vsnprintf(out, len + 1, fmt, ap); len = vsnprintf(out, len + 1, fmt, ap);
va_end(ap);
if (len == -1) if (len == -1)
return NULL; return NULL;
va_end(ap);
return out; return out;
} }