GCC throws -Wanalyzer-va-list-leak here since the function can return
before va_end is called. I checked and the NetBSD fixed this along time
ago. Not sure if it can cause any harm but bad style IMO.

-- 8< --

* src/rcp.c (run_err): Move va_start call after the early return.
---
 src/rcp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/rcp.c b/src/rcp.c
index 11b14c44..101f9563 100644
--- a/src/rcp.c
+++ b/src/rcp.c
@@ -1381,11 +1381,12 @@ run_err (const char *fmt, ...)
   static FILE *fp;
   va_list ap;
 
-  va_start (ap, fmt);
-
   ++errs;
   if (fp == NULL && !(fp = fdopen (rem, "w")))
     return;
+
+  va_start (ap, fmt);
+
   fprintf (fp, "%c", 0x01);
   fprintf (fp, "rcp: ");
   vfprintf (fp, fmt, ap);
-- 
2.45.2


  • [PATCH] rcp... Collin Funk
    • Re: [P... Simon Josefsson via Bug reports for the GNU Internet utilities

Reply via email to