[Tarantool-patches] [PATCH] cppcheck: src/httpc.c missed va_end() macro

Sergey Kaplun skaplun at tarantool.org
Mon Sep 21 08:26:24 MSK 2020


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



More information about the Tarantool-patches mailing list