Commit 83946d5c authored by Luca Boccassi's avatar Luca Boccassi Committed by Luca Boccassi

Problem: testutil_monitoring does not close received messages

Solution: do it, as above 32 bytes they might be on the heap
parent edf79dfe
...@@ -211,6 +211,7 @@ static int64_t get_monitor_event_internal_v2 (void *monitor_, ...@@ -211,6 +211,7 @@ static int64_t get_monitor_event_internal_v2 (void *monitor_,
uint64_t event; uint64_t event;
memcpy (&event, zmq_msg_data (&msg), sizeof event); memcpy (&event, zmq_msg_data (&msg), sizeof event);
zmq_msg_close (&msg);
// Second frame in message contains event value // Second frame in message contains event value
zmq_msg_init (&msg); zmq_msg_init (&msg);
...@@ -223,6 +224,7 @@ static int64_t get_monitor_event_internal_v2 (void *monitor_, ...@@ -223,6 +224,7 @@ static int64_t get_monitor_event_internal_v2 (void *monitor_,
if (value_) if (value_)
memcpy (value_, zmq_msg_data (&msg), sizeof *value_); memcpy (value_, zmq_msg_data (&msg), sizeof *value_);
zmq_msg_close (&msg);
// Third frame in message contains local address // Third frame in message contains local address
zmq_msg_init (&msg); zmq_msg_init (&msg);
...@@ -237,6 +239,7 @@ static int64_t get_monitor_event_internal_v2 (void *monitor_, ...@@ -237,6 +239,7 @@ static int64_t get_monitor_event_internal_v2 (void *monitor_,
memcpy (*local_address_, data, size); memcpy (*local_address_, data, size);
(*local_address_)[size] = 0; (*local_address_)[size] = 0;
} }
zmq_msg_close (&msg);
// Fourth and last frame in message contains remote address // Fourth and last frame in message contains remote address
zmq_msg_init (&msg); zmq_msg_init (&msg);
...@@ -251,6 +254,7 @@ static int64_t get_monitor_event_internal_v2 (void *monitor_, ...@@ -251,6 +254,7 @@ static int64_t get_monitor_event_internal_v2 (void *monitor_,
memcpy (*remote_address_, data, size); memcpy (*remote_address_, data, size);
(*remote_address_)[size] = 0; (*remote_address_)[size] = 0;
} }
zmq_msg_close (&msg);
return event; return event;
} }
......
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