Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the ZMQ-LibZMQ3 CPAN distribution.

Report information
The Basics
Id: 85153
Status: resolved
Priority: 0/
Queue: ZMQ-LibZMQ3

People
Owner: Nobody in particular
Requestors: ton.nijkes [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Memory leak in zmq_recv
Date: Thu, 9 May 2013 10:12:14 +0200
To: bug-ZMQ-LibZMQ3 [...] rt.cpan.org
From: Ton Nijkes <ton.nijkes [...] gmail.com>
Hi, I believe there is a memory leak in the P5ZMQ3_zmq_recv function. A temporary buffer is allocated, but only freed when something goes wrong. From perl_libzmq3.xs: int P5ZMQ3_zmq_recv(socket, buf_sv, len, flags = 0) P5ZMQ3_Socket *socket; SV *buf_sv; size_t len; int flags; PREINIT: char *buf; CODE: P5ZMQ3_TRACE( "START zmq_recv" ); Newxz( buf, len, char ); RETVAL = zmq_recv( socket->socket, buf, len, flags ); P5ZMQ3_TRACE(" + zmq_recv returned with rv '%d'", RETVAL); if ( RETVAL == -1 ) { SET_BANG; Safefree(buf); } else { sv_setpvn( buf_sv, buf, len ); } P5ZMQ3_TRACE( "END zmq_recv" ); OUTPUT: RETVAL To fix, I suggest placing the Safefree(buf) outside the if-statement: int P5ZMQ3_zmq_recv(socket, buf_sv, len, flags = 0) P5ZMQ3_Socket *socket; SV *buf_sv; size_t len; int flags; PREINIT: char *buf; CODE: P5ZMQ3_TRACE( "START zmq_recv" ); Newxz( buf, len, char ); RETVAL = zmq_recv( socket->socket, buf, len, flags ); P5ZMQ3_TRACE(" + zmq_recv returned with rv '%d'", RETVAL); if ( RETVAL == -1 ) { SET_BANG; } else { sv_setpvn( buf_sv, buf, len ); } Safefree(buf); P5ZMQ3_TRACE( "END zmq_recv" ); OUTPUT: RETVAL Best regards, Ton Nijkes
fixed and released ZMQ-LibZMQ3-1.11
Subject: Re: [rt.cpan.org #85153] Memory leak in zmq_recv
Date: Thu, 9 May 2013 13:15:00 +0200
To: bug-ZMQ-LibZMQ3 [...] rt.cpan.org
From: Ton Nijkes <ton.nijkes [...] gmail.com>
That is extremely fast :-) Thanks! On Thu, May 9, 2013 at 12:46 PM, Daisuke Maki via RT < bug-ZMQ-LibZMQ3@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=85153 > > > fixed and released ZMQ-LibZMQ3-1.11 >
Subject: Re: [rt.cpan.org #85153] Memory leak in zmq_recv
Date: Thu, 9 May 2013 13:16:59 +0200
To: bug-ZMQ-LibZMQ3 [...] rt.cpan.org
From: Ton Nijkes <ton.nijkes [...] gmail.com>
Do you recommend that I download 1.11 from GitHub or should I wait for the new release to appear on CPAN? On Thu, May 9, 2013 at 1:15 PM, Ton Nijkes <ton.nijkes@gmail.com> wrote: Show quoted text
> That is extremely fast :-) Thanks! > > > On Thu, May 9, 2013 at 12:46 PM, Daisuke Maki via RT < > bug-ZMQ-LibZMQ3@rt.cpan.org> wrote: >
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=85153 > >> >> fixed and released ZMQ-LibZMQ3-1.11 >>
> >
Show quoted text
> Do you recommend that I download 1.11 from GitHub or should I wait > for the new release to appear on CPAN?
Well it's already on MetaCPAN (https://metacpan.org/release/DMAKI/ZMQ-LibZMQ3-1.11). If you're not getting the latest version from your cpan client, then I suspect you're not using cpanminus, and in that case, you should ;) (but that's a different story)
Subject: Re: [rt.cpan.org #85153] Memory leak in zmq_recv
Date: Thu, 9 May 2013 14:06:14 +0200
To: bug-ZMQ-LibZMQ3 [...] rt.cpan.org
From: Ton Nijkes <ton.nijkes [...] gmail.com>
It's on CPAN now. Thanks. On Thu, May 9, 2013 at 1:24 PM, Daisuke Maki via RT < bug-ZMQ-LibZMQ3@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=85153 > > >
> > Do you recommend that I download 1.11 from GitHub or should I wait > > for the new release to appear on CPAN?
> > Well it's already on MetaCPAN ( > https://metacpan.org/release/DMAKI/ZMQ-LibZMQ3-1.11). > > If you're not getting the latest version from your cpan client, then I > suspect you're not using cpanminus, and in that case, you should ;) (but > that's a different story) >