0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-28 16:15:23 +08:00

Merge pull request #1771 from bluca/valgrind_iterator

Problem: Valgrind reports read of freed memory
This commit is contained in:
Joe Eli McIlvain 2016-02-04 14:36:59 -08:00
commit 02120203b2

View File

@ -99,9 +99,11 @@ void zmq::radio_t::xwrite_activated (pipe_t *pipe_)
void zmq::radio_t::xpipe_terminated (pipe_t *pipe_)
{
for (subscriptions_t::iterator it = subscriptions.begin (); it != subscriptions.end (); ++it) {
for (subscriptions_t::iterator it = subscriptions.begin (); it != subscriptions.end (); ) {
if (it->second == pipe_) {
subscriptions.erase (it);
subscriptions.erase (it++);
} else {
++it;
}
}