aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--socket.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/socket.c b/socket.c
index bc9af2f..f6319ca 100644
--- a/socket.c
+++ b/socket.c
@@ -65,6 +65,21 @@ struct socket *socreate(Slirp *slirp)
void sofree(struct socket *so)
{
Slirp *slirp = so->slirp;
+ struct mbuf *ifm;
+
+ for (ifm = (struct mbuf *)slirp->if_fastq.qh_link;
+ (struct quehead *)ifm != &slirp->if_fastq; ifm = ifm->ifq_next) {
+ if (ifm->ifq_so == so) {
+ ifm->ifq_so = NULL;
+ }
+ }
+
+ for (ifm = (struct mbuf *)slirp->if_batchq.qh_link;
+ (struct quehead *)ifm != &slirp->if_batchq; ifm = ifm->ifq_next) {
+ if (ifm->ifq_so == so) {
+ ifm->ifq_so = NULL;
+ }
+ }
if (so->so_emu == EMU_RSH && so->extra) {
sofree(so->extra);