Commit 6e952053 authored by Taras Shpot's avatar Taras Shpot Committed by Martin Sustrik

Fix memory leak under Windows

The comment about memory ownership in uuid_t::to_string
was misleading as on most platforms the buffer is a field
of the object;
The string allocated in UuidToString() wasn't properly freed
with RpcStringFree()
Signed-off-by: 's avatarTaras Shpot <taras.shpot@eleks.com>
parent 5b440256
...@@ -34,6 +34,7 @@ Piotr Trojanek <piotr.trojanek@gmail.com> ...@@ -34,6 +34,7 @@ Piotr Trojanek <piotr.trojanek@gmail.com>
Sebastian Otaegui <feniix@gmail.com> Sebastian Otaegui <feniix@gmail.com>
Steven McCoy <steven.mccoy@miru.hk> Steven McCoy <steven.mccoy@miru.hk>
Tamara Kustarova <kustarova.tamara@gmail.com> Tamara Kustarova <kustarova.tamara@gmail.com>
Taras Shpot <taras.shpot@eleks.com>
Tero Marttila <terom@fixme.fi> Tero Marttila <terom@fixme.fi>
Terry Wilson <terry@logivox.net> Terry Wilson <terry@logivox.net>
Vitaly Mayatskikh <v.mayatskih@gmail.com> Vitaly Mayatskikh <v.mayatskih@gmail.com>
......
...@@ -41,6 +41,8 @@ zmq::uuid_t::uuid_t () ...@@ -41,6 +41,8 @@ zmq::uuid_t::uuid_t ()
zmq::uuid_t::~uuid_t () zmq::uuid_t::~uuid_t ()
{ {
if (string_buf)
RpcStringFree (&string_buf);
} }
const char *zmq::uuid_t::to_string () const char *zmq::uuid_t::to_string ()
......
...@@ -58,7 +58,7 @@ namespace zmq ...@@ -58,7 +58,7 @@ namespace zmq
enum { uuid_string_len = 36 }; enum { uuid_string_len = 36 };
// Returns a pointer to buffer containing the textual // Returns a pointer to buffer containing the textual
// representation of the UUID. The caller is reponsible to // representation of the UUID. The callee is reponsible to
// free the allocated memory. // free the allocated memory.
const char *to_string (); const char *to_string ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment