Print this page
5763 missing va_end() on return from __fini_daemon_priv()

@@ -18,10 +18,11 @@
  *
  * CDDL HEADER END
  */
 
 /*
+ * Copyright 2015 Gary Mills
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #pragma weak _getprivimplinfo   = getprivimplinfo
 #pragma weak _priv_addset       = priv_addset

@@ -569,24 +570,24 @@
 __fini_daemon_priv(const char *priv, ...)
 {
         priv_set_t *nset;
         va_list pa;
 
-        va_start(pa, priv);
-
         if (priv != NULL) {
+
+                va_start(pa, priv);
                 nset = priv_vlist(pa);
+                va_end(pa);
+
                 if (nset == NULL)
                         return;
 
                 (void) priv_addset(nset, priv);
                 (void) setppriv(PRIV_OFF, permitted, nset);
                 priv_freeset(nset);
         }
 
-        va_end(pa);
-
         (void) setpflags(__PROC_PROTECT, 0);
 }
 
 /*
  * The routine __init_suid_priv() is private to Solaris and is