summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/zmq_msg_init_data.txt4
-rw-r--r--src/msg.cpp5
2 files changed, 7 insertions, 2 deletions
diff --git a/doc/zmq_msg_init_data.txt b/doc/zmq_msg_init_data.txt
index a36787c..ed35dbc 100644
--- a/doc/zmq_msg_init_data.txt
+++ b/doc/zmq_msg_init_data.txt
@@ -44,7 +44,9 @@ it shall return `-1` and set 'errno' to one of the values defined below.
ERRORS
------
-No errors are defined.
+*ENOMEM*::
+Insufficient storage space is available.
+
EXAMPLE
diff --git a/src/msg.cpp b/src/msg.cpp
index f88a902..84ca3e2 100644
--- a/src/msg.cpp
+++ b/src/msg.cpp
@@ -74,7 +74,10 @@ int zmq::msg_t::init_data (void *data_, size_t size_, msg_free_fn *ffn_,
u.lmsg.type = type_lmsg;
u.lmsg.flags = 0;
u.lmsg.content = (content_t*) malloc (sizeof (content_t));
- alloc_assert (u.lmsg.content);
+ if (!u.lmsg.content) {
+ errno = ENOMEM;
+ return -1;
+ }
u.lmsg.content->data = data_;
u.lmsg.content->size = size_;