diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-04-18 20:26:08 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-04-18 20:26:08 +0000 |
commit | 866fe0e24b34fcada9122736014071185d485119 (patch) | |
tree | 59d941128da0493552ea3cb8312aaebb140ade36 /usr.bin/cvs/server.c | |
parent | 8f36c2ecb4df730fd9642eba3fce269d6982f136 (diff) |
Properly check memory allocation in client code. While at it, unified
vasprintf() check across OpenCVS code base.
Based on a diff by Jacek Masiulaniec.
ok (and unification requested by) xsa
Diffstat (limited to 'usr.bin/cvs/server.c')
-rw-r--r-- | usr.bin/cvs/server.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c index 6293237abb8..25c8ad35384 100644 --- a/usr.bin/cvs/server.c +++ b/usr.bin/cvs/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.84 2008/02/11 20:33:11 tobias Exp $ */ +/* $OpenBSD: server.c,v 1.85 2008/04/18 20:26:07 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -142,13 +142,15 @@ cvs_server(int argc, char **argv) void cvs_server_send_response(char *fmt, ...) { + int i; va_list ap; char *data; va_start(ap, fmt); - if (vasprintf(&data, fmt, ap) == -1) - fatal("vasprintf: %s", strerror(errno)); + i = vasprintf(&data, fmt, ap); va_end(ap); + if (i == -1) + fatal("cvs_server_send_response: %s", strerror(errno)); cvs_log(LP_TRACE, "%s", data); cvs_remote_output(data); |