diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 8bd487d57a9..fc7ef8bd9ef 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -283,14 +283,14 @@ void sofree(so) struct socket *so; { - struct socket *head = so->so_head; int s; KASSERT(so->so_count == 0, ("socket %p so_count not 0", so)); if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0) return; - if (head != NULL) { + if (so->so_head != NULL) { + struct socket *head = so->so_head; if (so->so_state & SS_INCOMP) { TAILQ_REMOVE(&head->so_incomp, so, so_list); head->so_incqlen--;