Don't close underlying file descriptor before destroying a tls_socket
authorMartin Willi <martin@revosec.ch>
Mon, 18 Feb 2013 10:45:01 +0000 (11:45 +0100)
committerMartin Willi <martin@revosec.ch>
Thu, 28 Feb 2013 15:46:07 +0000 (16:46 +0100)
tls_socket cleanup usually sends a TLS close notify, for which it uses a valid
socket.

src/libpttls/pt_tls_client.c

index 948d929..7f91ae6 100644 (file)
@@ -276,8 +276,11 @@ METHOD(pt_tls_client_t, destroy, void,
 {
        if (this->tls)
        {
-               close(this->tls->get_fd(this->tls));
+               int fd;
+
+               fd = this->tls->get_fd(this->tls);
                this->tls->destroy(this->tls);
+               close(fd);
        }
        this->address->destroy(this->address);
        this->id->destroy(this->id);