diff --git a/src/ctx.cpp b/src/ctx.cpp index a05b2b15..fa35cf0e 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -74,14 +74,12 @@ zmq::ctx_t::~ctx_t () delete io_threads [i]; // Deallocate the reaper thread object. - if (reaper) - delete reaper; + delete reaper; // Deallocate the array of mailboxes. No special work is // needed as mailboxes themselves were deallocated with their // corresponding io_thread/socket objects. - if (slots) - free (slots); + free (slots); // Remove the tag, so that the object is considered dead. tag = ZMQ_CTX_TAG_VALUE_BAD; diff --git a/src/mtrie.cpp b/src/mtrie.cpp index f84eefd0..c09e2d28 100644 --- a/src/mtrie.cpp +++ b/src/mtrie.cpp @@ -54,8 +54,7 @@ zmq::mtrie_t::~mtrie_t () else if (count > 1) { for (unsigned short i = 0; i != count; ++i) - if (next.table [i]) - delete next.table [i]; + delete next.table [i]; free (next.table); } } diff --git a/src/session_base.cpp b/src/session_base.cpp index efb04379..40b9a821 100644 --- a/src/session_base.cpp +++ b/src/session_base.cpp @@ -96,8 +96,7 @@ zmq::session_base_t::~session_base_t () if (engine) engine->terminate (); - if (addr) - delete addr; + delete addr; } void zmq::session_base_t::attach_pipe (pipe_t *pipe_) diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp index cfdf67a4..87efc31a 100644 --- a/src/stream_engine.cpp +++ b/src/stream_engine.cpp @@ -114,12 +114,9 @@ zmq::stream_engine_t::~stream_engine_t () int rc = tx_msg.close (); errno_assert (rc == 0); - if (encoder != NULL) - delete encoder; - if (decoder != NULL) - delete decoder; - if (mechanism != NULL) - delete mechanism; + delete encoder; + delete decoder; + delete mechanism; } void zmq::stream_engine_t::plug (io_thread_t *io_thread_, diff --git a/src/trie.cpp b/src/trie.cpp index 96b06574..e495499e 100644 --- a/src/trie.cpp +++ b/src/trie.cpp @@ -48,8 +48,7 @@ zmq::trie_t::~trie_t () else if (count > 1) { for (unsigned short i = 0; i != count; ++i) - if (next.table [i]) - delete next.table [i]; + delete next.table [i]; free (next.table); } } diff --git a/src/yqueue.hpp b/src/yqueue.hpp index 76cce54b..56046dab 100644 --- a/src/yqueue.hpp +++ b/src/yqueue.hpp @@ -72,8 +72,7 @@ namespace zmq } chunk_t *sc = spare_chunk.xchg (NULL); - if (sc) - free (sc); + free (sc); } // Returns reference to the front element of the queue. @@ -156,8 +155,7 @@ namespace zmq // so for cache reasons we'll get rid of the spare and // use 'o' as the spare. chunk_t *cs = spare_chunk.xchg (o); - if (cs) - free (cs); + free (cs); } }