0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-14 09:47:56 +08:00

zmq_msg_init_data returns ERRNO instead aborting

Signed-off-by: Paul Colomiets <pc@gafol.net>
This commit is contained in:
Paul Colomiets 2011-05-17 10:09:04 +02:00 committed by Martin Sustrik
parent d8d5a627b1
commit 864c18f797
2 changed files with 7 additions and 2 deletions

View File

@ -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

View File

@ -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_;