summaryrefslogtreecommitdiff
path: root/lib/frr_zmq.c
diff options
context:
space:
mode:
authorMark Stapp <mjs.ietf@gmail.com>2021-08-09 11:55:15 -0400
committerMark Stapp <mjs.ietf@gmail.com>2021-08-19 13:31:33 -0400
commitcf2182c013e57fbcb98ff0f42be7f0d1542c51df (patch)
tree707cf6e6bcd5e9ab74ad46bb498c1f4156176a2a /lib/frr_zmq.c
parent1dfa8b8991153f9a0085f50aaac1f58da75164ad (diff)
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>
Diffstat (limited to 'lib/frr_zmq.c')
-rw-r--r--lib/frr_zmq.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c
index ea9c828f7c..994fe656fd 100644
--- a/lib/frr_zmq.c
+++ b/lib/frr_zmq.c
@@ -92,7 +92,8 @@ static int frrzmq_read_msg(struct thread *t)
ZMQ_POLLOUT);
cb->read.thread = NULL;
if (cb->write.cancelled && !cb->write.thread)
- XFREE(MTYPE_ZEROMQ_CB, cb);
+ XFREE(MTYPE_ZEROMQ_CB, *cbp);
+
return 0;
}
continue;
@@ -120,7 +121,8 @@ static int frrzmq_read_msg(struct thread *t)
ZMQ_POLLOUT);
cb->read.thread = NULL;
if (cb->write.cancelled && !cb->write.thread)
- XFREE(MTYPE_ZEROMQ_CB, cb);
+ XFREE(MTYPE_ZEROMQ_CB, *cbp);
+
return 0;
}
@@ -239,7 +241,8 @@ static int frrzmq_write_msg(struct thread *t)
frrzmq_check_events(cbp, &cb->read, ZMQ_POLLIN);
cb->write.thread = NULL;
if (cb->read.cancelled && !cb->read.thread)
- XFREE(MTYPE_ZEROMQ_CB, cb);
+ XFREE(MTYPE_ZEROMQ_CB, *cbp);
+
return 0;
}
continue;