msg->init was missing for ROUTER_RAW with empty message

Description

None

Environment

None

Activity

Show:

PieterP October 28, 2013 at 8:00 PM

Note the ZMQ_ROUTER_RAW + ZMQ_ROUTER_MANDATORY functionality was repackaged as ZMQ_STREAM, which had the same bug. So I've renamed the test case to test_stream_empty and added the fix to stream.cpp, and verified before/after behavior.

PieterP October 28, 2013 at 7:54 PM

Nice, I'm backporting this to 4.0.2

Min RK October 28, 2013 at 7:05 PM

When you send a message, the following calls always take place inside send:

zmq_msg_close(msg);
zmq_msg_init(msg);

When you send an empty frame on ROUTER_RAW, there is a special case branch, which includes zmq_msg_close(msg), but returns immediately, without reaching the end of the function which called zmq_msg_init(msg). The result is Bad Address error when the user tries to close the frame after sending.

PR #721 simply adds the missing zmq_msg_init(msg), to make the behavior consistent.

Fixed

Details

Assignee

Reporter

Fix versions

Affects versions

Priority

Created October 28, 2013 at 10:24 AM
Updated October 28, 2013 at 8:00 PM
Resolved October 28, 2013 at 7:46 PM