From 2bcc300a0ff22d426e012085e8464fa73d6417dc Mon Sep 17 00:00:00 2001 From: Pieter Hintjens Date: Mon, 26 Mar 2012 16:31:10 -0500 Subject: [PATCH] Fixed issue #348 --- builds/valgrind/valgrind.supp | 14 ++++++++++ builds/valgrind/vg | 1 + src/object.cpp | 48 ----------------------------------- 3 files changed, 15 insertions(+), 48 deletions(-) create mode 100644 builds/valgrind/valgrind.supp create mode 100755 builds/valgrind/vg diff --git a/builds/valgrind/valgrind.supp b/builds/valgrind/valgrind.supp new file mode 100644 index 00000000..ccd71a61 --- /dev/null +++ b/builds/valgrind/valgrind.supp @@ -0,0 +1,14 @@ +{ + + Memcheck:Param + socketcall.sendto(msg) + fun:send + ... +} +{ + + Memcheck:Param + socketcall.send(msg) + fun:send + ... +} diff --git a/builds/valgrind/vg b/builds/valgrind/vg new file mode 100755 index 00000000..9dfbfb57 --- /dev/null +++ b/builds/valgrind/vg @@ -0,0 +1 @@ +valgrind --tool=memcheck --leak-check=full --suppressions=valgrind.supp $* diff --git a/src/object.cpp b/src/object.cpp index 04044d39..80784d7a 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -159,9 +159,6 @@ void zmq::object_t::send_stop () // 'stop' command goes always from administrative thread to // the current object. command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = this; cmd.type = command_t::stop; ctx->send_command (tid, cmd); @@ -173,9 +170,6 @@ void zmq::object_t::send_plug (own_t *destination_, bool inc_seqnum_) destination_->inc_seqnum (); command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::plug; send_command (cmd); @@ -185,9 +179,6 @@ void zmq::object_t::send_own (own_t *destination_, own_t *object_) { destination_->inc_seqnum (); command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::own; cmd.args.own.object = object_; @@ -201,9 +192,6 @@ void zmq::object_t::send_attach (session_base_t *destination_, destination_->inc_seqnum (); command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::attach; cmd.args.attach.engine = engine_; @@ -217,9 +205,6 @@ void zmq::object_t::send_bind (own_t *destination_, pipe_t *pipe_, destination_->inc_seqnum (); command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::bind; cmd.args.bind.pipe = pipe_; @@ -229,9 +214,6 @@ void zmq::object_t::send_bind (own_t *destination_, pipe_t *pipe_, void zmq::object_t::send_activate_read (pipe_t *destination_) { command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::activate_read; send_command (cmd); @@ -241,9 +223,6 @@ void zmq::object_t::send_activate_write (pipe_t *destination_, uint64_t msgs_read_) { command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::activate_write; cmd.args.activate_write.msgs_read = msgs_read_; @@ -253,9 +232,6 @@ void zmq::object_t::send_activate_write (pipe_t *destination_, void zmq::object_t::send_hiccup (pipe_t *destination_, void *pipe_) { command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::hiccup; cmd.args.hiccup.pipe = pipe_; @@ -265,9 +241,6 @@ void zmq::object_t::send_hiccup (pipe_t *destination_, void *pipe_) void zmq::object_t::send_pipe_term (pipe_t *destination_) { command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::pipe_term; send_command (cmd); @@ -276,9 +249,6 @@ void zmq::object_t::send_pipe_term (pipe_t *destination_) void zmq::object_t::send_pipe_term_ack (pipe_t *destination_) { command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::pipe_term_ack; send_command (cmd); @@ -288,9 +258,6 @@ void zmq::object_t::send_term_req (own_t *destination_, own_t *object_) { command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::term_req; cmd.args.term_req.object = object_; @@ -300,9 +267,6 @@ void zmq::object_t::send_term_req (own_t *destination_, void zmq::object_t::send_term (own_t *destination_, int linger_) { command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::term; cmd.args.term.linger = linger_; @@ -312,9 +276,6 @@ void zmq::object_t::send_term (own_t *destination_, int linger_) void zmq::object_t::send_term_ack (own_t *destination_) { command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = destination_; cmd.type = command_t::term_ack; send_command (cmd); @@ -323,9 +284,6 @@ void zmq::object_t::send_term_ack (own_t *destination_) void zmq::object_t::send_reap (class socket_base_t *socket_) { command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = ctx->get_reaper (); cmd.type = command_t::reap; cmd.args.reap.socket = socket_; @@ -335,9 +293,6 @@ void zmq::object_t::send_reap (class socket_base_t *socket_) void zmq::object_t::send_reaped () { command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = ctx->get_reaper (); cmd.type = command_t::reaped; send_command (cmd); @@ -346,9 +301,6 @@ void zmq::object_t::send_reaped () void zmq::object_t::send_done () { command_t cmd; -#if defined ZMQ_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif cmd.destination = NULL; cmd.type = command_t::done; ctx->send_command (ctx_t::term_tid, cmd);