mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-27 08:00:11 +00:00
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
This commit is contained in:
parent
e4b8a2fc5a
commit
ba670ce023
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241021
@ -678,6 +678,7 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...)
|
||||
|
||||
dtp->dt_buffered_offs += needed;
|
||||
assert(dtp->dt_buffered_buf[dtp->dt_buffered_offs] == '\0');
|
||||
va_end(ap);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -368,6 +368,7 @@ zfs_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...)
|
||||
case ENOSPC:
|
||||
case EDQUOT:
|
||||
zfs_verror(hdl, EZFS_NOSPC, fmt, ap);
|
||||
va_end(ap);
|
||||
return (-1);
|
||||
|
||||
case EEXIST:
|
||||
@ -467,6 +468,7 @@ zpool_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...)
|
||||
case ENOSPC:
|
||||
case EDQUOT:
|
||||
zfs_verror(hdl, EZFS_NOSPC, fmt, ap);
|
||||
va_end(ap);
|
||||
return (-1);
|
||||
|
||||
case EAGAIN:
|
||||
|
@ -1600,8 +1600,10 @@ output_data(const char *format, ...)
|
||||
char *buf;
|
||||
|
||||
va_start(args, format);
|
||||
if ((len = vasprintf(&buf, format, args)) == -1)
|
||||
if ((len = vasprintf(&buf, format, args)) == -1) {
|
||||
va_end(args);
|
||||
return -1;
|
||||
}
|
||||
output_datalen(buf, len);
|
||||
va_end(args);
|
||||
free(buf);
|
||||
|
@ -789,18 +789,24 @@ proto_printf(struct stream *wr, const char *format, ...)
|
||||
|
||||
case '%':
|
||||
n = stream_write(wr, "%", 1);
|
||||
if (n == -1)
|
||||
if (n == -1) {
|
||||
va_end(ap);
|
||||
return (-1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (rv == -1)
|
||||
if (rv == -1) {
|
||||
va_end(ap);
|
||||
return (-1);
|
||||
}
|
||||
fmt = cp + 1;
|
||||
}
|
||||
if (*fmt != '\0') {
|
||||
rv = stream_printf(wr, "%s", fmt);
|
||||
if (rv == -1)
|
||||
if (rv == -1) {
|
||||
va_end(ap);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
done:
|
||||
va_end(ap);
|
||||
|
@ -93,6 +93,7 @@ vpipe(const char *fmt, ...)
|
||||
fp = popen(cmd, "r");
|
||||
if (fp == NULL) {
|
||||
warnx("popen() failed");
|
||||
va_end(args);
|
||||
return NULL;
|
||||
}
|
||||
get_string(rp, MAXPATHLEN, fp);
|
||||
|
@ -102,6 +102,7 @@ pwdb(char *arg,...)
|
||||
if (WEXITSTATUS(i))
|
||||
i = EIO;
|
||||
}
|
||||
va_end(ap);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user