From 5c93e1c60bedff580af64f1f7b46aec0aa1b0e36 Mon Sep 17 00:00:00 2001 From: ngie Date: Wed, 16 Dec 2015 02:43:34 +0000 Subject: [PATCH] MFC r292005: Call va_end on ap when vsnprintf fails in run_cmd(..) to clean up the variable state Reported by: cppcheck Sponsored by: EMC / Isilon Storage Division git-svn-id: svn://svn.freebsd.org/base/stable/10@292311 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sbin/swapon/swapon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c index 033c40a8e..635105309 100644 --- a/sbin/swapon/swapon.c +++ b/sbin/swapon/swapon.c @@ -640,6 +640,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); -- 2.45.0