From 0687986bb30a3c550ce056fc1170712c90188257 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 4 Sep 2023 00:50:09 +0200 Subject: pflocal: Remove unused write_addr field It was never set, and re-connecting a socket to another address would try to deref the port, thus crashing. --- pflocal/sock.c | 7 +------ pflocal/sock.h | 4 ---- 2 files changed, 1 insertion(+), 10 deletions(-) (limited to 'pflocal') diff --git a/pflocal/sock.c b/pflocal/sock.c index 3daf8282..90c618ec 100644 --- a/pflocal/sock.c +++ b/pflocal/sock.c @@ -394,7 +394,6 @@ sock_connect (struct sock *sock1, struct sock *sock2) /* In the case of a connectionless protocol, an already-connected socket may be reconnected, so save the old destination for later disposal. */ struct pipe *old_sock1_write_pipe = NULL; - struct addr *old_sock1_write_addr = NULL; void connect (struct sock *wr, struct sock *rd) { @@ -426,7 +425,6 @@ sock_connect (struct sock *sock1, struct sock *sock2) else { old_sock1_write_pipe = sock1->write_pipe; - old_sock1_write_addr = sock1->write_addr; /* Always make the forward connection. */ connect (sock1, sock2); @@ -449,10 +447,7 @@ sock_connect (struct sock *sock1, struct sock *sock2) pthread_mutex_unlock (&socket_pair_lock); if (old_sock1_write_pipe) - { - pipe_remove_writer (old_sock1_write_pipe); - ports_port_deref (old_sock1_write_addr); - } + pipe_remove_writer (old_sock1_write_pipe); return err; } diff --git a/pflocal/sock.h b/pflocal/sock.h index c686dec4..6a724d4c 100644 --- a/pflocal/sock.h +++ b/pflocal/sock.h @@ -74,10 +74,6 @@ struct sock one could tell anyway). */ struct addr *addr; - /* If this sock has been connected to another sock, then WRITE_ADDR is the - addr of that sock. We *do* hold a reference to this addr. */ - struct addr *write_addr; - /* A connection queue to listen for incoming connections on. Once a socket has one of these, it always does, and can never again be used for anything but accepting incoming connections. */ -- cgit v1.2.3