From 9dae2c94560e0b8e5a69f8d2b22f4abc858c3bd7 Mon Sep 17 00:00:00 2001 From: Michael Santos Date: Thu, 28 Oct 2010 20:45:35 -0400 Subject: ei: check memory was allocated --- lib/erl_interface/src/misc/ei_portio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/erl_interface/src/misc/ei_portio.c b/lib/erl_interface/src/misc/ei_portio.c index c4e397f1e0..a3f6f63fff 100644 --- a/lib/erl_interface/src/misc/ei_portio.c +++ b/lib/erl_interface/src/misc/ei_portio.c @@ -166,6 +166,9 @@ int ei_writev_fill_t(int fd, const struct iovec *iov, int iovcnt, unsigned if (done < sum) { if (iov_base == NULL) { iov_base = malloc(sizeof(struct iovec) * iovcnt); + if (iov_base == NULL) { + return -1; + } memcpy(iov_base, iov, sizeof(struct iovec) * iovcnt); current_iov = iov_base; } -- cgit v1.2.3