From 33c2e470b49a346575dbab3e018fd0c2162a478b Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 9 Dec 2015 01:24:34 +0000 Subject: [PATCH] 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 --- sbin/swapon/swapon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c index ed9f5685b6bc..f58143179c2f 100644 --- a/sbin/swapon/swapon.c +++ b/sbin/swapon/swapon.c @@ -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);