uuid.cpp cause memory leak

Description

in uuid.cpp line 233

...

void zmq::uuid_t::create_blob ()
{
char buf = new char; buf = reinterpret_cast<char>(string_buf);

#ifdef UNICODE // we need to jump twice as far.
blob_buf [0] = convert_byte (buf + 0);

...

when rapidly connect and disconnect to bind socket, the memory usage continuous increase

valgrind report:

==18534== 39,894 bytes in 39,894 blocks are definitely lost in loss record 82 of 86
==18534== at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18534== by 0x4E53A4D: zmq::uuid_t::create_blob() (uuid.cpp:233)
==18534== by 0x4E5954C: zmq::zmq_init_t::write(zmq_msg_t*) (zmq_init.cpp:86)
==18534== by 0x4E40D95: zmq::decoder_t::message_ready() (decoder.cpp:129)
==18534== by 0x4E5875F: zmq::zmq_engine_t::in_event() (decoder.hpp:122)
==18534== by 0x4E4667D: zmq::object_t:rocess_command(zmq::command_t&) (object.cpp:75)
==18534== by 0x4E4354B: zmq::io_thread_t::in_event() (io_thread.cpp:83)
==18534== by 0x4E4250D: zmq::epoll_t::loop() (epoll.cpp:161)
==18534== by 0x4E52EB5: thread_routine (thread.cpp:75)
==18534== by 0x583BE99: start_thread (pthread_create.c:308)
==18534== by 0x515BCBC: clone (clone.S:112)

Environment

ubuntu 12.04

Activity

Show:

feidong December 4, 2012 at 9:56 AM

I just change line 233 to

char buf ; buf = reinterpret_cast<char>(string_buf);

Now the memory usage do not continuously increase and valgrind report has no more definitely lost

Fixed

Details

Assignee

Reporter

Fix versions

Affects versions

Priority

Created December 4, 2012 at 8:00 AM
Updated December 4, 2012 at 12:10 PM
Resolved December 4, 2012 at 12:10 PM