Added NEWS about streamlined plugin names
[strongswan.git] / src / scepclient / loglite.c
index b14e72e..539bb5f 100644 (file)
@@ -56,33 +56,35 @@ static void scepclient_dbg(int level, char *fmt, ...)
        else if (cur_debugging & DBG_RAW)
        {
                debug_level = 3;
-       }       
+       }
        else if (cur_debugging & DBG_PARSING)
        {
                debug_level = 2;
        }
-       else 
+       else
        {
                debug_level = 1;
        }
 
        if (level <= debug_level)
        {
-               va_start(args, fmt);
-
                if (log_to_stderr)
                {
                        if (level > 1)
                        {
                                fprintf(stderr, "| ");
                        }
+                       va_start(args, fmt);
                        vfprintf(stderr, fmt, args);
+                       va_end(args);
                        fprintf(stderr, "\n");
                }
                if (log_to_syslog)
                {
                        /* write in memory buffer first */
+                       va_start(args, fmt);
                        vsnprintf(buffer, sizeof(buffer), fmt, args);
+                       va_end(args);
 
                        /* do a syslog with every line */
                        while (current)
@@ -96,7 +98,6 @@ static void scepclient_dbg(int level, char *fmt, ...)
                                current = next;
                        }
                }
-               va_end(args);
        }
 }