diff options
author | Christian Weisgerber <naddy@cvs.openbsd.org> | 2020-11-28 22:06:26 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@cvs.openbsd.org> | 2020-11-28 22:06:26 +0000 |
commit | 6738e0b6eda425183323ce7dfb75ec554648e605 (patch) | |
tree | b5d0015cb0dcb0441b3124f08d4ba849e3738769 /sbin/slaacd | |
parent | 5acb79143b346d254054b437abf73543d238cf27 (diff) |
improve legibility of the newly introduced unref_icmp6ev() before this
code gets copied around; ok florian@
Diffstat (limited to 'sbin/slaacd')
-rw-r--r-- | sbin/slaacd/frontend.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sbin/slaacd/frontend.c b/sbin/slaacd/frontend.c index 6cae8c9ca05..5d01cfb8960 100644 --- a/sbin/slaacd/frontend.c +++ b/sbin/slaacd/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.39 2020/11/28 07:59:26 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.40 2020/11/28 22:06:25 naddy Exp $ */ /* * Copyright (c) 2017 Florian Obser <florian@openbsd.org> @@ -1137,14 +1137,16 @@ get_icmp6ev_by_rdomain(int rdomain) void unref_icmp6ev(struct iface *iface) { - if (iface->icmp6ev != NULL) { - iface->icmp6ev->refcnt--; - if (iface->icmp6ev->refcnt == 0) { - event_del(&iface->icmp6ev->ev); - close(EVENT_FD(&iface->icmp6ev->ev)); - free(iface->icmp6ev); + struct icmp6_ev *icmp6ev = iface->icmp6ev; + + if (icmp6ev != NULL) { + icmp6ev->refcnt--; + if (icmp6ev->refcnt == 0) { + event_del(&icmp6ev->ev); + close(EVENT_FD(&icmp6ev->ev)); + free(icmp6ev); } - iface->icmp6ev = NULL; + icmp6ev = NULL; } } |