Resolve LIBZMQ-464

This commit is contained in:
Martin Hurton
2012-11-01 14:37:42 +01:00
parent 0404b3b60a
commit 7c66e8f807

View File

@@ -283,7 +283,14 @@ bool zmq::msg_t::rm_refs (int refs_)
// The only message type that needs special care are long messages.
if (!u.lmsg.content->refcnt.sub (refs_)) {
close ();
// We used "placement new" operator to initialize the reference
// counter so we call the destructor explicitly now.
u.lmsg.content->refcnt.~atomic_counter_t ();
if (u.lmsg.content->ffn)
u.lmsg.content->ffn (u.lmsg.content->data, u.lmsg.content->hint);
free (u.lmsg.content);
return false;
}