socket: Move closesocket(so->s_aux) to sofree
Signed-off-by: Nicholas Ngai <nicholas@ngai.me>
diff --git a/src/socket.c b/src/socket.c
index 8aa942e..f071d69 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -84,6 +84,10 @@
{
Slirp *slirp = so->slirp;
+ if (so->s_aux != -1) {
+ closesocket(so->s_aux);
+ }
+
soqfree(so, &slirp->if_fastq);
soqfree(so, &slirp->if_batchq);
diff --git a/src/tcp_subr.c b/src/tcp_subr.c
index 8feff5b..636c447 100644
--- a/src/tcp_subr.c
+++ b/src/tcp_subr.c
@@ -339,9 +339,6 @@
slirp->tcp_last_so = &slirp->tcb;
so->slirp->cb->unregister_poll_fd(so->s, so->slirp->opaque);
closesocket(so->s);
- if (so->s_aux != -1) {
- closesocket(so->s_aux);
- }
sbfree(&so->so_rcv);
sbfree(&so->so_snd);
sofree(so);
diff --git a/src/udp.c b/src/udp.c
index 74013b1..2e45eb4 100644
--- a/src/udp.c
+++ b/src/udp.c
@@ -339,9 +339,6 @@
{
so->slirp->cb->unregister_poll_fd(so->s, so->slirp->opaque);
closesocket(so->s);
- if (so->s_aux != -1) {
- closesocket(so->s_aux);
- }
sofree(so);
}