summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-ndisc.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-09-24 17:26:35 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-09-24 17:26:41 +0900
commiteb2f750242d6c4c0963887dbd561d8bafa318685 (patch)
treed0ec4eb0b64403789e392725dbac007e772e6111 /src/libsystemd-network/sd-ndisc.c
parentd105befc976ad704d3b17b3a5ee1b659a5f624d4 (diff)
downloadsystemd-eb2f750242d6c4c0963887dbd561d8bafa318685.tar.gz
libsystemd-network: disable event sources before unref them
Fixes #20825.
Diffstat (limited to 'src/libsystemd-network/sd-ndisc.c')
-rw-r--r--src/libsystemd-network/sd-ndisc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c
index 9fff9929f7..0c27b7ea72 100644
--- a/src/libsystemd-network/sd-ndisc.c
+++ b/src/libsystemd-network/sd-ndisc.c
@@ -133,18 +133,19 @@ static void ndisc_reset(sd_ndisc *nd) {
(void) event_source_disable(nd->timeout_event_source);
(void) event_source_disable(nd->timeout_no_ra);
nd->retransmit_time = 0;
- nd->recv_event_source = sd_event_source_unref(nd->recv_event_source);
+ nd->recv_event_source = sd_event_source_disable_unref(nd->recv_event_source);
nd->fd = safe_close(nd->fd);
}
static sd_ndisc *ndisc_free(sd_ndisc *nd) {
assert(nd);
- nd->timeout_event_source = sd_event_source_unref(nd->timeout_event_source);
- nd->timeout_no_ra = sd_event_source_unref(nd->timeout_no_ra);
-
ndisc_reset(nd);
+
+ sd_event_source_unref(nd->timeout_event_source);
+ sd_event_source_unref(nd->timeout_no_ra);
sd_ndisc_detach_event(nd);
+
free(nd->ifname);
return mfree(nd);
}