Skip to content

Commit

Permalink
Accessing an iterator after it is accessed is not valid.
Browse files Browse the repository at this point in the history
Moving the erase after the access and check agains current_id.
  • Loading branch information
demozon authored and hintjens committed May 4, 2011
1 parent 339a114 commit 36e2361
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/xrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ void zmq::xrep_t::terminated (reader_t *pipe_)
for (inpipes_t::iterator it = inpipes.begin (); it != inpipes.end ();
++it) {
if (it->reader == pipe_) {
inpipes.erase (it);
if ((inpipes_t::size_type) (it - inpipes.begin ()) < current_in)
current_in--;
inpipes.erase (it);
if (terminating)
unregister_term_ack ();
return;
Expand Down

0 comments on commit 36e2361

Please sign in to comment.