* [Tarantool-patches] [PATCH] cppcheck: src/httpc.c missed va_end() macro
@ 2020-09-21 5:26 Sergey Kaplun
2020-09-21 7:03 ` Cyrill Gorcunov
2020-09-22 5:04 ` Sergey Kaplun
0 siblings, 2 replies; 3+ messages in thread
From: Sergey Kaplun @ 2020-09-21 5:26 UTC (permalink / raw)
To: Kirill Yukhin, Cyrill Gorcunov; +Cc: tarantool-patches
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Tarantool-patches] [PATCH] cppcheck: src/httpc.c missed va_end() macro
2020-09-21 5:26 [Tarantool-patches] [PATCH] cppcheck: src/httpc.c missed va_end() macro Sergey Kaplun
@ 2020-09-21 7:03 ` Cyrill Gorcunov
2020-09-22 5:04 ` Sergey Kaplun
1 sibling, 0 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2020-09-21 7:03 UTC (permalink / raw)
To: Sergey Kaplun; +Cc: tarantool-patches
On Mon, Sep 21, 2020 at 08:26:24AM +0300, 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().
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Tarantool-patches] [PATCH] cppcheck: src/httpc.c missed va_end() macro
2020-09-21 5:26 [Tarantool-patches] [PATCH] cppcheck: src/httpc.c missed va_end() macro Sergey Kaplun
2020-09-21 7:03 ` Cyrill Gorcunov
@ 2020-09-22 5:04 ` Sergey Kaplun
1 sibling, 0 replies; 3+ messages in thread
From: Sergey Kaplun @ 2020-09-22 5:04 UTC (permalink / raw)
To: Kirill Yukhin, Cyrill Gorcunov; +Cc: tarantool-patches
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-22 5:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 5:26 [Tarantool-patches] [PATCH] cppcheck: src/httpc.c missed va_end() macro Sergey Kaplun
2020-09-21 7:03 ` Cyrill Gorcunov
2020-09-22 5:04 ` Sergey Kaplun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox