[zeromq-dev] [PATCH]

Martin Sustrik sustrik at moloch.sk
Thu Oct 7 17:10:11 CEST 2010


Hi Daniel,

I've tried to apply your patch, however, I've realised there's a problem 
there. When you close the message, you may still use it in the next 
iteration, thus accessing deinitialised data.

We have to think of something more sophisticated...

Martin

On 10/07/2010 03:52 PM, Daniel Sentenac wrote:
> In attachment the patch proposed for resolving memory leak in PUB 
> sockets:
>
> From 34bad5b47805ad0d2704caeac661c03468f66013 Mon Sep 17 00:00:00 2001
> From: Daniel Sentenac <daniel.sentenac at ego-gw.it>
> Date: Thu, 7 Oct 2010 15:47:35 +0200
> Subject: [PATCH] fixed memory leak bug
> Signed-off-by: Daniel Sentenac <daniel.sentenac at ego-gw.it>
>
> ---
> src/pub.cpp |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/pub.cpp b/src/pub.cpp
> index b1a1239..471c8ed 100644
> --- a/src/pub.cpp
> +++ b/src/pub.cpp
> @@ -140,7 +140,7 @@ int zmq::pub_t::xsend (zmq_msg_t *msg_, int flags_)
>     //  Push the message to all destinations.
>     for (pipes_t::size_type i = 0; i < active;) {
>         if (!write (pipes [i], msg_))
> -            content->refcnt.sub (1);
> +            zmq_msg_close(msg_);
>         else
>             i++;
>     }
> -- 
> 1.6.0.3
>
>
> Cheers,
> Daniel
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20101007/fe1b8e9e/attachment.htm>


More information about the zeromq-dev mailing list