forked from Mirror/frr
lib: clear caller's pointer when freeing context struct
The zeromq lib wrapper uses an internal context struct to help interact with the libfrr event mechanism. When freeing that context struct, ensure the caller's pointer is also cleared. Signed-off-by: Mark Stapp <mjs.ietf@gmail.com>
This commit is contained in:
parent
1dfa8b8991
commit
cf2182c013
|
@ -92,7 +92,8 @@ static int frrzmq_read_msg(struct thread *t)
|
||||||
ZMQ_POLLOUT);
|
ZMQ_POLLOUT);
|
||||||
cb->read.thread = NULL;
|
cb->read.thread = NULL;
|
||||||
if (cb->write.cancelled && !cb->write.thread)
|
if (cb->write.cancelled && !cb->write.thread)
|
||||||
XFREE(MTYPE_ZEROMQ_CB, cb);
|
XFREE(MTYPE_ZEROMQ_CB, *cbp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -120,7 +121,8 @@ static int frrzmq_read_msg(struct thread *t)
|
||||||
ZMQ_POLLOUT);
|
ZMQ_POLLOUT);
|
||||||
cb->read.thread = NULL;
|
cb->read.thread = NULL;
|
||||||
if (cb->write.cancelled && !cb->write.thread)
|
if (cb->write.cancelled && !cb->write.thread)
|
||||||
XFREE(MTYPE_ZEROMQ_CB, cb);
|
XFREE(MTYPE_ZEROMQ_CB, *cbp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +241,8 @@ static int frrzmq_write_msg(struct thread *t)
|
||||||
frrzmq_check_events(cbp, &cb->read, ZMQ_POLLIN);
|
frrzmq_check_events(cbp, &cb->read, ZMQ_POLLIN);
|
||||||
cb->write.thread = NULL;
|
cb->write.thread = NULL;
|
||||||
if (cb->read.cancelled && !cb->read.thread)
|
if (cb->read.cancelled && !cb->read.thread)
|
||||||
XFREE(MTYPE_ZEROMQ_CB, cb);
|
XFREE(MTYPE_ZEROMQ_CB, *cbp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue