From 33b031ce7a9b8b1b7c729518af965b7cb70a1cd6 Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Wed, 10 Oct 2018 15:01:50 +0100 Subject: [PATCH] Add missing va_end found by Coverity This commit adds a missing va_end found by Coverity. gdb/ChangeLog: * remote.c (remote_target::remote_send_printf): Add missing va_end found by Coverity. --- gdb/ChangeLog | 5 +++++ gdb/remote.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dc355102abd..aac5b7a09a8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-10-10 Gary Benson + + * remote.c (remote_target::remote_send_printf): Add + missing va_end found by Coverity. + 2018-10-10 Markus Metzger * btrace.c (ftrace_update_function): Add indirect jump heuristic. diff --git a/gdb/remote.c b/gdb/remote.c index 724f41cf71e..c53553af5bd 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8938,7 +8938,11 @@ remote_target::remote_send_printf (const char *format, ...) va_start (ap, format); rs->buf[0] = '\0'; - if (vsnprintf (rs->buf, max_size, format, ap) >= max_size) + int size = vsnprintf (rs->buf, max_size, format, ap); + + va_end (ap); + + if (size >= max_size) internal_error (__FILE__, __LINE__, _("Too long remote packet.")); if (putpkt (rs->buf) < 0) -- 2.30.2