socket: Free poll handle when resetting socket state

Since 07cb0be12 we are not closing the user provided FDs,
but the above change also resulted in memory leak during
ssh_disconnect that left the poll_handle allocated during
reset.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2025-08-11 15:49:32 +02:00
parent 5691e0f609
commit 118a747acd

View File

@@ -202,7 +202,10 @@ void ssh_socket_reset(ssh_socket s)
s->read_wontblock = 0;
s->write_wontblock = 0;
s->data_except = 0;
s->poll_handle = NULL;
if (s->poll_handle != NULL) {
ssh_poll_free(s->poll_handle);
s->poll_handle = NULL;
}
s->state=SSH_SOCKET_NONE;
#ifndef _WIN32
s->proxy_pid = 0;