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
This commit is contained in:
Enji Cooper 2015-12-09 01:24:34 +00:00
parent 692a3987f2
commit 33c2e470b4

View File

@ -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);