From fb9de67c11db6ab2f5e3d705d842cb99481c1ee3 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sat, 3 Jul 1999 02:37:57 +0000 Subject: [PATCH] (writev): error check malloc properly git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6405 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/roken/writev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/roken/writev.c b/lib/roken/writev.c index 8aaf39754..e6175f3d6 100644 --- a/lib/roken/writev.c +++ b/lib/roken/writev.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -54,7 +54,7 @@ writev(int d, const struct iovec *iov, int iovcnt) for(i = 0; i < iovcnt; ++i) tot += iov[i].iov_len; buf = malloc(tot); - if (buf == NULL) { + if (tot != 0 && buf == NULL) { errno = ENOMEM; return -1; }