diff options
author | kevlo <kevlo@FreeBSD.org> | 2012-09-28 07:51:30 +0000 |
---|---|---|
committer | kevlo <kevlo@FreeBSD.org> | 2012-09-28 07:51:30 +0000 |
commit | a93e845e54aef353af783f879e3482a9e473a572 (patch) | |
tree | f864a7f6a0ad8eb6c98c82aec4ef26f6d771057c /usr.bin | |
parent | 55f6ff40edbcb6a2a67bfeb9304aecc846a4390d (diff) | |
download | FreeBSD-src-a93e845e54aef353af783f879e3482a9e473a572.zip FreeBSD-src-a93e845e54aef353af783f879e3482a9e473a572.tar.gz |
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/csup/proto.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/csup/proto.c b/usr.bin/csup/proto.c index 145deb3..28841dd 100644 --- a/usr.bin/csup/proto.c +++ b/usr.bin/csup/proto.c @@ -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); |