define a macro for heap object deletion in a unified manner (related to issue #1524)

This commit is contained in:
reza.ebrahimi
2015-08-17 00:35:11 +04:30
parent 9bf88bcc03
commit 1621c25ef0
19 changed files with 93 additions and 108 deletions

View File

@@ -235,9 +235,11 @@ int zmq::msg_t::close ()
}
}
if (u.base.metadata != NULL)
if (u.base.metadata->drop_ref ())
delete u.base.metadata;
if (u.base.metadata != NULL) {
if (u.base.metadata->drop_ref ()) {
LIBZMQ_DELETE(u.base.metadata);
}
}
// Make the message invalid.
u.base.type = 0;
@@ -392,8 +394,7 @@ void zmq::msg_t::reset_metadata ()
{
if (u.base.metadata) {
if (u.base.metadata->drop_ref ())
delete u.base.metadata;
u.base.metadata = NULL;
LIBZMQ_DELETE(u.base.metadata);
}
}