svn commit: r292005 - head/sbin/swapon

Garrett Cooper ngie at FreeBSD.org
Wed Dec 9 01:24:36 UTC 2015


Author: ngie
Date: Wed Dec  9 01:24:34 2015
New Revision: 292005
URL: https://svnweb.freebsd.org/changeset/base/292005

Log:
  Call va_end on ap when vsnprintf fails in run_cmd(..) to clean up
  the variable state
  
  MFC after: 1 week
  Reported by: cppcheck
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sbin/swapon/swapon.c

Modified: head/sbin/swapon/swapon.c
==============================================================================
--- head/sbin/swapon/swapon.c	Tue Dec  8 22:47:54 2015	(r292004)
+++ head/sbin/swapon/swapon.c	Wed Dec  9 01:24:34 2015	(r292005)
@@ -642,6 +642,7 @@ run_cmd(int *ofd, const char *cmdline, .
 	rv = vasprintf(&cmd, cmdline, ap);
 	if (rv == -1) {
 		warn("%s", __func__);
+		va_end(ap);
 		return (rv);
 	}
 	va_end(ap);


More information about the svn-src-head mailing list