mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-19 00:46:05 +01:00
Problem: fix for read-after-free not documented
Solution: add a comment as it's easy to miss and very tempting to "optimize"
This commit is contained in:
parent
dc39ceb347
commit
a06f97d73a
@ -100,6 +100,8 @@ void zmq::radio_t::xwrite_activated (pipe_t *pipe_)
|
|||||||
|
|
||||||
void zmq::radio_t::xpipe_terminated (pipe_t *pipe_)
|
void zmq::radio_t::xpipe_terminated (pipe_t *pipe_)
|
||||||
{
|
{
|
||||||
|
// NOTE: erase invalidates an iterator, and that's why it's not incrementing in post-loop
|
||||||
|
// read-after-free caught by Valgrind, see https://github.com/zeromq/libzmq/pull/1771
|
||||||
for (subscriptions_t::iterator it = subscriptions.begin (); it != subscriptions.end (); ) {
|
for (subscriptions_t::iterator it = subscriptions.begin (); it != subscriptions.end (); ) {
|
||||||
if (it->second == pipe_) {
|
if (it->second == pipe_) {
|
||||||
subscriptions.erase (it++);
|
subscriptions.erase (it++);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user