[PATCH 2/2] ei: check memory was allocated
Michael Santos
michael.santos@REDACTED
Fri Oct 29 02:45:35 CEST 2010
---
lib/erl_interface/src/misc/ei_portio.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/lib/erl_interface/src/misc/ei_portio.c b/lib/erl_interface/src/misc/ei_portio.c
index c4e397f..a3f6f63 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;
}
--
1.7.0.4
More information about the erlang-patches
mailing list