udp_timer_one() first checks for expiries of various sorts of sockets and if necessary sets the 'sockp' variable to trigger a cleanup at the end. If sockp is *not* set then, correctly, we don't attempt to close a non-existent socket. However, we also don't clear the flag in the udp_act[] map, in which case we'll come back here and there will, again, be nothing to be done. So, clear the udp_act[] flag, even if we don't need to clean up a socket. Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- udp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udp.c b/udp.c index 03a5936e..4200f849 100644 --- a/udp.c +++ b/udp.c @@ -1123,8 +1123,9 @@ static void udp_timer_one(struct ctx *c, int v6, enum udp_act_type type, *sockp = -1; epoll_ctl(c->epollfd, EPOLL_CTL_DEL, s, NULL); close(s); - bitmap_clear(udp_act[v6 ? V6 : V4][type], port); } + + bitmap_clear(udp_act[v6 ? V6 : V4][type], port); } /** -- 2.43.2