Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun <skaplun@tarantool.org>
To: Kirill Yukhin <kyukhin@tarantool.org>,
	Cyrill Gorcunov <gorcunov@gmail.com>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH] cppcheck: src/httpc.c missed va_end() macro
Date: Mon, 21 Sep 2020 08:26:24 +0300	[thread overview]
Message-ID: <20200921052624.9714-1-skaplun@tarantool.org> (raw)

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

             reply	other threads:[~2020-09-21  5:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21  5:26 Sergey Kaplun [this message]
2020-09-21  7:03 ` Cyrill Gorcunov
2020-09-22  5:04 ` Sergey Kaplun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200921052624.9714-1-skaplun@tarantool.org \
    --to=skaplun@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] cppcheck: src/httpc.c missed va_end() macro' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox