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:
ngie 2015-12-09 01:24:34 +00:00
parent 0ae8386452
commit 8140511319

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