diff --git a/builds/msvc/vs2010/inproc_lat/inproc_lat.vcxproj b/builds/msvc/vs2010/inproc_lat/inproc_lat.vcxproj index acff5615..77e8bee9 100644 --- a/builds/msvc/vs2010/inproc_lat/inproc_lat.vcxproj +++ b/builds/msvc/vs2010/inproc_lat/inproc_lat.vcxproj @@ -1,5 +1,5 @@  - + {6FF7436F-B3F6-4AE9-A3AC-CFDE8A3872A0} inproc_lat diff --git a/builds/msvc/vs2010/inproc_thr/inproc_thr.vcxproj b/builds/msvc/vs2010/inproc_thr/inproc_thr.vcxproj index e1d041c7..9498138d 100644 --- a/builds/msvc/vs2010/inproc_thr/inproc_thr.vcxproj +++ b/builds/msvc/vs2010/inproc_thr/inproc_thr.vcxproj @@ -1,5 +1,5 @@  - + {1077E977-95DD-4E73-A692-74647DD0CC1E} inproc_thr diff --git a/builds/msvc/vs2010/libzmq/libzmq.vcxproj b/builds/msvc/vs2010/libzmq/libzmq.vcxproj index fc46e3df..40fa35ae 100644 --- a/builds/msvc/vs2010/libzmq/libzmq.vcxproj +++ b/builds/msvc/vs2010/libzmq/libzmq.vcxproj @@ -1,5 +1,5 @@  - + {641C5F36-32EE-4323-B740-992B651CF9D6} libzmq diff --git a/builds/msvc/vs2010/local_lat/local_lat.vcxproj b/builds/msvc/vs2010/local_lat/local_lat.vcxproj index 2b7880d3..4079717e 100644 --- a/builds/msvc/vs2010/local_lat/local_lat.vcxproj +++ b/builds/msvc/vs2010/local_lat/local_lat.vcxproj @@ -1,5 +1,5 @@  - + {4FDB8C73-9D4A-4D87-A4A9-A7FC06DFEA57} local_lat diff --git a/builds/msvc/vs2010/local_thr/local_thr.vcxproj b/builds/msvc/vs2010/local_thr/local_thr.vcxproj index cffa0b57..8daafe3d 100644 --- a/builds/msvc/vs2010/local_thr/local_thr.vcxproj +++ b/builds/msvc/vs2010/local_thr/local_thr.vcxproj @@ -1,5 +1,5 @@  - + {8EF2DF6B-6646-460F-8032-913B70FE0E94} local_thr diff --git a/builds/msvc/vs2010/remote_lat/remote_lat.vcxproj b/builds/msvc/vs2010/remote_lat/remote_lat.vcxproj index 44a3a4f9..d044335a 100644 --- a/builds/msvc/vs2010/remote_lat/remote_lat.vcxproj +++ b/builds/msvc/vs2010/remote_lat/remote_lat.vcxproj @@ -1,5 +1,5 @@  - + {9C20A37C-5D9F-4C4C-A2D9-E6EE91A077D1} remote_lat diff --git a/builds/msvc/vs2010/remote_thr/remote_thr.vcxproj b/builds/msvc/vs2010/remote_thr/remote_thr.vcxproj index a156b14e..8784bf3f 100644 --- a/builds/msvc/vs2010/remote_thr/remote_thr.vcxproj +++ b/builds/msvc/vs2010/remote_thr/remote_thr.vcxproj @@ -1,5 +1,5 @@  - + {B15E059C-0CBB-4A82-8C42-6567FB650802} remote_thr diff --git a/builds/msvc/vs2012/inproc_lat/inproc_lat.vcxproj b/builds/msvc/vs2012/inproc_lat/inproc_lat.vcxproj index ff73ccec..ba729ae5 100644 --- a/builds/msvc/vs2012/inproc_lat/inproc_lat.vcxproj +++ b/builds/msvc/vs2012/inproc_lat/inproc_lat.vcxproj @@ -1,5 +1,5 @@  - + {6FF7436F-B3F6-4AE9-A3AC-CFDE8A3872A0} inproc_lat diff --git a/builds/msvc/vs2012/inproc_thr/inproc_thr.vcxproj b/builds/msvc/vs2012/inproc_thr/inproc_thr.vcxproj index e8bba125..7851f003 100644 --- a/builds/msvc/vs2012/inproc_thr/inproc_thr.vcxproj +++ b/builds/msvc/vs2012/inproc_thr/inproc_thr.vcxproj @@ -1,5 +1,5 @@  - + {1077E977-95DD-4E73-A692-74647DD0CC1E} inproc_thr diff --git a/builds/msvc/vs2012/libzmq/libzmq.vcxproj b/builds/msvc/vs2012/libzmq/libzmq.vcxproj index 22f0982c..7af296d7 100644 --- a/builds/msvc/vs2012/libzmq/libzmq.vcxproj +++ b/builds/msvc/vs2012/libzmq/libzmq.vcxproj @@ -1,5 +1,5 @@  - + {641C5F36-32EE-4323-B740-992B651CF9D6} libzmq diff --git a/builds/msvc/vs2012/local_lat/local_lat.vcxproj b/builds/msvc/vs2012/local_lat/local_lat.vcxproj index 075d59e1..d1c89b64 100644 --- a/builds/msvc/vs2012/local_lat/local_lat.vcxproj +++ b/builds/msvc/vs2012/local_lat/local_lat.vcxproj @@ -1,5 +1,5 @@  - + {4FDB8C73-9D4A-4D87-A4A9-A7FC06DFEA57} local_lat diff --git a/builds/msvc/vs2012/local_thr/local_thr.vcxproj b/builds/msvc/vs2012/local_thr/local_thr.vcxproj index 707e7fc9..40d02aa1 100644 --- a/builds/msvc/vs2012/local_thr/local_thr.vcxproj +++ b/builds/msvc/vs2012/local_thr/local_thr.vcxproj @@ -1,5 +1,5 @@  - + {8EF2DF6B-6646-460F-8032-913B70FE0E94} local_thr diff --git a/builds/msvc/vs2012/remote_lat/remote_lat.vcxproj b/builds/msvc/vs2012/remote_lat/remote_lat.vcxproj index adbf021b..98285be7 100644 --- a/builds/msvc/vs2012/remote_lat/remote_lat.vcxproj +++ b/builds/msvc/vs2012/remote_lat/remote_lat.vcxproj @@ -1,5 +1,5 @@  - + {9C20A37C-5D9F-4C4C-A2D9-E6EE91A077D1} remote_lat diff --git a/builds/msvc/vs2012/remote_thr/remote_thr.vcxproj b/builds/msvc/vs2012/remote_thr/remote_thr.vcxproj index 0d0dac73..3d227f16 100644 --- a/builds/msvc/vs2012/remote_thr/remote_thr.vcxproj +++ b/builds/msvc/vs2012/remote_thr/remote_thr.vcxproj @@ -1,5 +1,5 @@  - + {B15E059C-0CBB-4A82-8C42-6567FB650802} remote_thr diff --git a/builds/msvc/vs2013/libzmq/libzmq.vcxproj b/builds/msvc/vs2013/libzmq/libzmq.vcxproj index cf1f2f86..931424de 100644 --- a/builds/msvc/vs2013/libzmq/libzmq.vcxproj +++ b/builds/msvc/vs2013/libzmq/libzmq.vcxproj @@ -1,5 +1,5 @@  - + {641C5F36-32EE-4323-B740-992B651CF9D6} libzmq diff --git a/builds/msvc/vs2015/inproc_lat/inproc_lat.vcxproj b/builds/msvc/vs2015/inproc_lat/inproc_lat.vcxproj index baca6284..95cfa929 100644 --- a/builds/msvc/vs2015/inproc_lat/inproc_lat.vcxproj +++ b/builds/msvc/vs2015/inproc_lat/inproc_lat.vcxproj @@ -1,5 +1,5 @@  - + {6FF7436F-B3F6-4AE9-A3AC-CFDE8A3872A0} inproc_lat diff --git a/builds/msvc/vs2015/inproc_thr/inproc_thr.vcxproj b/builds/msvc/vs2015/inproc_thr/inproc_thr.vcxproj index 65693f0c..5e0f7aa5 100644 --- a/builds/msvc/vs2015/inproc_thr/inproc_thr.vcxproj +++ b/builds/msvc/vs2015/inproc_thr/inproc_thr.vcxproj @@ -1,5 +1,5 @@  - + {1077E977-95DD-4E73-A692-74647DD0CC1E} inproc_thr diff --git a/builds/msvc/vs2015/libzmq/libzmq.vcxproj b/builds/msvc/vs2015/libzmq/libzmq.vcxproj index 92268007..43150274 100644 --- a/builds/msvc/vs2015/libzmq/libzmq.vcxproj +++ b/builds/msvc/vs2015/libzmq/libzmq.vcxproj @@ -1,5 +1,5 @@  - + {641C5F36-32EE-4323-B740-992B651CF9D6} libzmq diff --git a/builds/msvc/vs2015/local_lat/local_lat.vcxproj b/builds/msvc/vs2015/local_lat/local_lat.vcxproj index 2bd4b4dc..a51b6e5b 100644 --- a/builds/msvc/vs2015/local_lat/local_lat.vcxproj +++ b/builds/msvc/vs2015/local_lat/local_lat.vcxproj @@ -1,5 +1,5 @@  - + {4FDB8C73-9D4A-4D87-A4A9-A7FC06DFEA57} local_lat diff --git a/builds/msvc/vs2015/local_thr/local_thr.vcxproj b/builds/msvc/vs2015/local_thr/local_thr.vcxproj index 92061294..1ffd7146 100644 --- a/builds/msvc/vs2015/local_thr/local_thr.vcxproj +++ b/builds/msvc/vs2015/local_thr/local_thr.vcxproj @@ -1,5 +1,5 @@  - + {8EF2DF6B-6646-460F-8032-913B70FE0E94} local_thr diff --git a/builds/msvc/vs2015/remote_lat/remote_lat.vcxproj b/builds/msvc/vs2015/remote_lat/remote_lat.vcxproj index e09ab583..290950c4 100644 --- a/builds/msvc/vs2015/remote_lat/remote_lat.vcxproj +++ b/builds/msvc/vs2015/remote_lat/remote_lat.vcxproj @@ -1,5 +1,5 @@  - + {9C20A37C-5D9F-4C4C-A2D9-E6EE91A077D1} remote_lat diff --git a/builds/msvc/vs2015/remote_thr/remote_thr.vcxproj b/builds/msvc/vs2015/remote_thr/remote_thr.vcxproj index bf25935a..88f82845 100644 --- a/builds/msvc/vs2015/remote_thr/remote_thr.vcxproj +++ b/builds/msvc/vs2015/remote_thr/remote_thr.vcxproj @@ -1,5 +1,5 @@  - + {B15E059C-0CBB-4A82-8C42-6567FB650802} remote_thr diff --git a/src/clock.cpp b/src/clock.cpp index fe1740c6..342bd01f 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -108,6 +108,8 @@ f_compatible_get_tick_count64 init_compatible_get_tick_count64() if (func == NULL) func = compatible_get_tick_count64; + ::FreeLibrary(module); + return func; } diff --git a/src/dish.cpp b/src/dish.cpp index b67e445f..7c71f985 100644 --- a/src/dish.cpp +++ b/src/dish.cpp @@ -332,13 +332,15 @@ int zmq::dish_session_t::pull_msg (msg_t *msg_) int offset; if (msg_->is_join ()) { - command.init_size (group_length + 5); - offset = 5; + rc = command.init_size (group_length + 5); + errno_assert(rc == 0); + offset = 5; memcpy (command.data (), "\4JOIN", 5); } else { - command.init_size (group_length + 6); - offset = 6; + rc = command.init_size (group_length + 6); + errno_assert(rc == 0); + offset = 6; memcpy (command.data (), "\5LEAVE", 6); } @@ -349,7 +351,7 @@ int zmq::dish_session_t::pull_msg (msg_t *msg_) memcpy (command_data + offset, msg_->group (), group_length); // Close the join message - int rc = msg_->close (); + rc = msg_->close (); errno_assert (rc == 0); *msg_ = command; diff --git a/src/encoder.hpp b/src/encoder.hpp index 009f5551..1d13ce85 100644 --- a/src/encoder.hpp +++ b/src/encoder.hpp @@ -58,6 +58,10 @@ namespace zmq inline encoder_base_t (size_t bufsize_) : bufsize (bufsize_), + write_pos(0), + to_write(0), + next(nullptr), + new_msg_flag(false), in_progress (NULL) { buf = (unsigned char*) malloc (bufsize_); diff --git a/src/null_mechanism.cpp b/src/null_mechanism.cpp index 45a25a94..5a63b293 100644 --- a/src/null_mechanism.cpp +++ b/src/null_mechanism.cpp @@ -157,7 +157,7 @@ int zmq::null_mechanism_t::process_handshake_command (msg_t *msg_) } if (rc == 0) { - int rc = msg_->close (); + rc = msg_->close (); errno_assert (rc == 0); rc = msg_->init (); errno_assert (rc == 0); diff --git a/src/pipe.cpp b/src/pipe.cpp index 48ae8ec8..71b740e0 100644 --- a/src/pipe.cpp +++ b/src/pipe.cpp @@ -92,6 +92,7 @@ zmq::pipe_t::pipe_t (object_t *parent_, upipe_t *inpipe_, upipe_t *outpipe_, sink (NULL), state (active), delay (true), + routing_id(0), conflate (conflate_) { } diff --git a/src/poller_base.cpp b/src/poller_base.cpp index 50c540c3..269f48b8 100644 --- a/src/poller_base.cpp +++ b/src/poller_base.cpp @@ -53,7 +53,7 @@ void zmq::poller_base_t::adjust_load (int amount_) load.add (amount_); else if (amount_ < 0) - load.sub (-amount_); + bool reset = load.sub (-amount_); } void zmq::poller_base_t::add_timer (int timeout_, i_poll_events *sink_, int id_) diff --git a/src/radio.cpp b/src/radio.cpp index 45e84154..5ba10f02 100644 --- a/src/radio.cpp +++ b/src/radio.cpp @@ -227,8 +227,9 @@ int zmq::radio_session_t::pull_msg (msg_t *msg_) int length = (int) strlen (group); // First frame is the group - msg_->init_size (length); - msg_->set_flags (msg_t::more); + rc = msg_->init_size (length); + errno_assert(rc == 0); + msg_->set_flags(msg_t::more); memcpy (msg_->data (), group, length); // Next status is the body diff --git a/src/reaper.cpp b/src/reaper.cpp index 4fb931fc..e0c9db25 100644 --- a/src/reaper.cpp +++ b/src/reaper.cpp @@ -36,6 +36,7 @@ zmq::reaper_t::reaper_t (class ctx_t *ctx_, uint32_t tid_) : object_t (ctx_, tid_), sockets (0), + mailbox_handle(NULL), terminating (false) { poller = new (std::nothrow) poller_t (*ctx_); diff --git a/src/router.cpp b/src/router.cpp index 979903b0..04f36d37 100644 --- a/src/router.cpp +++ b/src/router.cpp @@ -155,9 +155,9 @@ void zmq::router_t::xpipe_terminated (pipe_t *pipe_) if (it != anonymous_pipes.end ()) anonymous_pipes.erase (it); else { - outpipes_t::iterator it = outpipes.find (pipe_->get_identity ()); - zmq_assert (it != outpipes.end ()); - outpipes.erase (it); + outpipes_t::iterator iter = outpipes.find (pipe_->get_identity ()); + zmq_assert (iter != outpipes.end ()); + outpipes.erase (iter); fq.pipe_terminated (pipe_); if (pipe_ == current_out) current_out = NULL; diff --git a/src/server.cpp b/src/server.cpp index e50e75d7..ffbe0a1a 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -122,7 +122,7 @@ int zmq::server_t::xsend (msg_t *msg_) bool ok = it->second.pipe->write (msg_); if (unlikely (!ok)) { // Message failed to send - we must close it ourselves. - int rc = msg_->close (); + rc = msg_->close (); errno_assert (rc == 0); } else diff --git a/src/signaler.cpp b/src/signaler.cpp index 1af7c8d5..5bb76185 100644 --- a/src/signaler.cpp +++ b/src/signaler.cpp @@ -539,7 +539,8 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_) saved_errno = WSAGetLastError (); // We don't need the listening socket anymore. Close it. - closesocket (listener); + rc = closesocket (listener); + wsa_assert(rc != SOCKET_ERROR); if (sync != NULL) { // Exit the critical section. diff --git a/src/socket_base.cpp b/src/socket_base.cpp index b80ccf05..0ab19208 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -191,6 +191,8 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_, bool monitor_socket (NULL), monitor_events (0), thread_safe (thread_safe_), + poller(nullptr), + handle(NULL), reaper_signaler (NULL) { options.socket_id = sid_; @@ -452,7 +454,7 @@ int zmq::socket_base_t::getsockopt (int option_, void *optval_, EXIT_MUTEX (); return -1; } - strcpy (static_cast (optval_), last_endpoint.c_str ()); + strncpy(static_cast (optval_), last_endpoint.c_str(), last_endpoint.size() + 1); *optvallen_ = last_endpoint.size () + 1; EXIT_MUTEX (); return 0; @@ -557,7 +559,7 @@ int zmq::socket_base_t::bind (const char *addr_) if (protocol == "inproc") { const endpoint_t endpoint = { this, options }; - const int rc = register_endpoint (addr_, endpoint); + rc = register_endpoint (addr_, endpoint); if (rc == 0) { connect_pending (addr_, this); last_endpoint.assign (addr_); @@ -590,7 +592,7 @@ int zmq::socket_base_t::bind (const char *addr_) tcp_listener_t *listener = new (std::nothrow) tcp_listener_t ( io_thread, this, options); alloc_assert (listener); - int rc = listener->set_address (address.c_str ()); + rc = listener->set_address (address.c_str ()); if (rc != 0) { LIBZMQ_DELETE(listener); event_bind_failed (address, zmq_errno()); @@ -739,7 +741,7 @@ int zmq::socket_base_t::connect (const char *addr_) int hwms [2] = {conflate? -1 : sndhwm, conflate? -1 : rcvhwm}; bool conflates [2] = {conflate, conflate}; - int rc = pipepair (parents, new_pipes, hwms, conflates); + rc = pipepair (parents, new_pipes, hwms, conflates); if (!conflate) { new_pipes[0]->set_hwms_boost(peer.options.sndhwm, peer.options.rcvhwm); new_pipes[1]->set_hwms_boost(options.sndhwm, options.rcvhwm); @@ -894,7 +896,7 @@ int zmq::socket_base_t::connect (const char *addr_) if (protocol == "udp") { paddr->resolved.udp_addr = new (std::nothrow) udp_address_t (); alloc_assert (paddr->resolved.udp_addr); - int rc = paddr->resolved.udp_addr->resolve (address.c_str()); + rc = paddr->resolved.udp_addr->resolve (address.c_str()); if (rc != 0) { LIBZMQ_DELETE(paddr); EXIT_MUTEX (); @@ -1501,9 +1503,10 @@ void zmq::socket_base_t::in_event () if (thread_safe) reaper_signaler->recv(); - process_commands (0, false); - EXIT_MUTEX (); - check_destroy (); + int rc = process_commands (0, false); + EXIT_MUTEX(); + errno_assert(rc == 0); + check_destroy(); } void zmq::socket_base_t::out_event () diff --git a/src/socket_poller.cpp b/src/socket_poller.cpp index 862bf814..de53de6d 100644 --- a/src/socket_poller.cpp +++ b/src/socket_poller.cpp @@ -34,12 +34,20 @@ zmq::socket_poller_t::socket_poller_t () : tag (0xCAFEBABE), need_rebuild (true), + poll_size(0), + maxfd(0), use_signaler (false) #if defined ZMQ_POLL_BASED_ON_POLL , pollfds (NULL) #endif { +#if defined ZMQ_POLL_BASED_ON_SELECT + memset(&pollset_in, 0, sizeof(pollset_in)); + memset(&pollset_out, 0, sizeof(pollset_in)); + memset(&pollset_err, 0, sizeof(pollset_in)); + maxfd = 0; +#endif } zmq::socket_poller_t::~socket_poller_t () diff --git a/src/socks_connecter.cpp b/src/socks_connecter.cpp index 0449f222..163bc72a 100644 --- a/src/socks_connecter.cpp +++ b/src/socks_connecter.cpp @@ -63,6 +63,9 @@ zmq::socks_connecter_t::socks_connecter_t (class io_thread_t *io_thread_, s (retired_fd), delayed_start (delayed_start_), session (session_), + handle(NULL), + handle_valid(false), + timer_started(false), current_reconnect_ivl (options.reconnect_ivl) { zmq_assert (addr); @@ -113,13 +116,13 @@ void zmq::socks_connecter_t::in_event () && status != waiting_for_reconnect_time); if (status == waiting_for_choice) { - const int rc = choice_decoder.input (s); + int rc = choice_decoder.input (s); if (rc == 0 || rc == -1) error (); else if (choice_decoder.message_ready ()) { const socks_choice_t choice = choice_decoder.decode (); - const int rc = process_server_response (choice); + rc = process_server_response (choice); if (rc == -1) error (); else { @@ -139,13 +142,13 @@ void zmq::socks_connecter_t::in_event () } else if (status == waiting_for_response) { - const int rc = response_decoder.input (s); + int rc = response_decoder.input (s); if (rc == 0 || rc == -1) error (); else if (response_decoder.message_ready ()) { const socks_response_t response = response_decoder.decode (); - const int rc = process_server_response (response); + rc = process_server_response (response); if (rc == -1) error (); else { diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp index 648d303c..5e89e0a7 100644 --- a/src/stream_engine.cpp +++ b/src/stream_engine.cpp @@ -87,6 +87,8 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_, has_timeout_timer (false), has_heartbeat_timer (false), heartbeat_timeout (0), + as_server(false), + handle(NULL), socket (NULL) { int rc = tx_msg.init (); @@ -1018,8 +1020,9 @@ int zmq::stream_engine_t::produce_ping_message(msg_t * msg_) zmq_assert (mechanism != NULL); // 16-bit TTL + \4PING == 7 - msg_->init_size(7); - msg_->set_flags(msg_t::command); + rc = msg_->init_size(7); + errno_assert(rc == 0); + msg_->set_flags(msg_t::command); // Copy in the command message memcpy(msg_->data(), "\4PING", 5); @@ -1040,8 +1043,9 @@ int zmq::stream_engine_t::produce_pong_message(msg_t * msg_) int rc = 0; zmq_assert (mechanism != NULL); - msg_->init_size(5); - msg_->set_flags(msg_t::command); + rc = msg_->init_size(5); + errno_assert(rc == 0); + msg_->set_flags(msg_t::command); memcpy(msg_->data(), "\4PONG", 5); diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp index 70bf42b1..e5e1a657 100644 --- a/src/tcp_connecter.cpp +++ b/src/tcp_connecter.cpp @@ -72,6 +72,7 @@ zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_, connect_timer_started (false), reconnect_timer_started (false), session (session_), + handle(NULL), current_reconnect_ivl (options.reconnect_ivl) { zmq_assert (addr); diff --git a/src/tcp_listener.cpp b/src/tcp_listener.cpp index 2e4f0c91..75fd17f5 100644 --- a/src/tcp_listener.cpp +++ b/src/tcp_listener.cpp @@ -65,6 +65,7 @@ zmq::tcp_listener_t::tcp_listener_t (io_thread_t *io_thread_, own_t (io_thread_, options_), io_object_t (io_thread_), s (retired_fd), + handle(NULL), socket (socket_) { } diff --git a/src/thread.hpp b/src/thread.hpp index 561091a7..2d98defc 100644 --- a/src/thread.hpp +++ b/src/thread.hpp @@ -55,6 +55,9 @@ namespace zmq public: inline thread_t () + : tfn(nullptr) + , arg(nullptr) + , descriptor(NULL) { } diff --git a/src/udp_address.cpp b/src/udp_address.cpp index 3403f09a..d927d0af 100644 --- a/src/udp_address.cpp +++ b/src/udp_address.cpp @@ -48,6 +48,7 @@ #endif zmq::udp_address_t::udp_address_t () + : is_mutlicast(false) { memset (&bind_address, 0, sizeof bind_address); memset (&dest_address, 0, sizeof dest_address); diff --git a/src/udp_engine.cpp b/src/udp_engine.cpp index 7470bc02..ef715426 100644 --- a/src/udp_engine.cpp +++ b/src/udp_engine.cpp @@ -48,6 +48,11 @@ along with this program. If not, see . zmq::udp_engine_t::udp_engine_t() : plugged (false), + fd(NULL), + address(nullptr), + send_enabled(false), + recv_enabled(false), + handle(NULL), session(NULL) { } @@ -122,7 +127,7 @@ void zmq::udp_engine_t::plug (io_thread_t* io_thread_, session_base_t *session_) struct ip_mreq mreq; mreq.imr_multiaddr = address->resolved.udp_addr->multicast_ip (); mreq.imr_interface = address->resolved.udp_addr->interface_ip (); - int rc = setsockopt (fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*) &mreq, sizeof (mreq)); + rc = setsockopt (fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*) &mreq, sizeof (mreq)); #ifdef ZMQ_HAVE_WINDOWS wsa_assert (rc != SOCKET_ERROR); #else diff --git a/src/xpub.cpp b/src/xpub.cpp index c1aea5f0..1deb7d67 100644 --- a/src/xpub.cpp +++ b/src/xpub.cpp @@ -173,7 +173,8 @@ int zmq::xpub_t::xsetsockopt (int option_, const void *optval_, welcome_msg.close(); if (optvallen_ > 0) { - welcome_msg.init_size(optvallen_); + int rc = welcome_msg.init_size(optvallen_); + errno_assert(rc == 0); unsigned char *data = (unsigned char*)welcome_msg.data(); memcpy(data, optval_, optvallen_); diff --git a/src/zmq.cpp b/src/zmq.cpp index 502d3d13..4078ee24 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -925,12 +925,9 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) // file descriptors. zmq_assert (nitems_ <= FD_SETSIZE); - fd_set pollset_in; - FD_ZERO (&pollset_in); - fd_set pollset_out; - FD_ZERO (&pollset_out); - fd_set pollset_err; - FD_ZERO (&pollset_err); + fd_set pollset_in = { 0 }; + fd_set pollset_out = { 0 }; + fd_set pollset_err = { 0 }; zmq::fd_t maxfd = 0;