diff options
author | Paul Colomiets <pc@gafol.net> | 2011-05-17 10:09:04 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-05-17 10:09:04 +0200 |
commit | 864c18f797203c06e66e739166b246cfb3d47ce9 (patch) | |
tree | a9b010653272af2df27d1742c776de8b6f03dfa0 | |
parent | d8d5a627b1835d20270125e27a157c9a7460f0e7 (diff) |
zmq_msg_init_data returns ERRNO instead aborting
Signed-off-by: Paul Colomiets <pc@gafol.net>
-rw-r--r-- | doc/zmq_msg_init_data.txt | 4 | ||||
-rw-r--r-- | src/msg.cpp | 5 |
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_; |