[Tarantool-patches] [PATCH] cppcheck: src/httpc.c missed va_end() macro
Sergey Kaplun
skaplun at tarantool.org
Tue Sep 22 08:04:00 MSK 2020
On 21.09.20, Sergey Kaplun wrote:
> Found and fixed not closed va_list 'ap' with cppcheck:
>
> [src/httpc.c:190]: (error) va_list 'ap' was opened but not closed by va_end().
> ---
>
> branch: https://github.com/tarantool/tarantool/tree/skaplun/cppcheck-httpc-missed-va-end
>
> src/httpc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/httpc.c b/src/httpc.c
> index be73e3684..cb49f6747 100644
> --- a/src/httpc.c
> +++ b/src/httpc.c
> @@ -185,11 +185,11 @@ httpc_set_header(struct httpc_request *req, const char *fmt, ...)
> va_list ap;
> va_start(ap, fmt);
> int rc = vsnprintf(header, MAX_HEADER_LEN + 1, fmt, ap);
> + va_end(ap);
> if (rc > MAX_HEADER_LEN) {
> diag_set(IllegalParams, "header is too large");
> return -1;
> }
> - va_end(ap);
>
> /**
> * Update flags for automanaged headers: no need to
> --
> 2.28.0
>
Since we don't have 'cppcheck' subsystem, I've changed it to 'httpc'.
I've updated commit message to:
```
httpc: src/httpc.c missed va_end() macro
Found and fixed not closed va_list 'ap' with cppcheck:
[src/httpc.c:190]: (error) va_list 'ap' was opened but not closed by va_end().
```
and pushed it to the branch.
--
Best regards,
Sergey Kaplun
More information about the Tarantool-patches
mailing list