ssh_do_close(ssh);
ssh_do_close(ssh, TRUE);
static void ssh_free(void *handle){    Ssh ssh = (Ssh) handle;    struct ssh_channel *c;    struct ssh_rportfwd *pf;    if (ssh->v1_cipher_ctx)	ssh->cipher->free_context(ssh->v1_cipher_ctx);    if (ssh->cs_cipher_ctx)	ssh->cscipher->free_context(ssh->cs_cipher_ctx);    if (ssh->sc_cipher_ctx)	ssh->sccipher->free_context(ssh->sc_cipher_ctx);    if (ssh->cs_mac_ctx)	ssh->csmac->free_context(ssh->cs_mac_ctx);    if (ssh->sc_mac_ctx)	ssh->scmac->free_context(ssh->sc_mac_ctx);    if (ssh->cs_comp_ctx) {	if (ssh->cscomp)	    ssh->cscomp->compress_cleanup(ssh->cs_comp_ctx);	else	    zlib_compress_cleanup(ssh->cs_comp_ctx);    }    if (ssh->sc_comp_ctx) {	if (ssh->sccomp)	    ssh->sccomp->decompress_cleanup(ssh->sc_comp_ctx);	else	    zlib_decompress_cleanup(ssh->sc_comp_ctx);    }    if (ssh->kex_ctx)	dh_cleanup(ssh->kex_ctx);    sfree(ssh->savedhost);    while (ssh->queuelen-- > 0)	ssh_free_packet(ssh->queue[ssh->queuelen]);    sfree(ssh->queue);    while (ssh->qhead) {	struct queued_handler *qh = ssh->qhead;	ssh->qhead = qh->next;	sfree(ssh->qhead);    }    ssh->qhead = ssh->qtail = NULL;    if (ssh->channels) {	while ((c = delpos234(ssh->channels, 0)) != NULL) {	    switch (c->type) {	      case CHAN_X11:		if (c->u.x11.s != NULL)		    x11_close(c->u.x11.s);		break;	      case CHAN_SOCKDATA:		if (c->u.pfd.s != NULL)		    pfd_close(c->u.pfd.s);		break;	    }	    sfree(c);	}	freetree234(ssh->channels);	ssh->channels = NULL;    }    if (ssh->rportfwds) {	while ((pf = delpos234(ssh->rportfwds, 0)) != NULL)	    sfree(pf);	freetree234(ssh->rportfwds);	ssh->rportfwds = NULL;    }    sfree(ssh->deferred_send_data);    if (ssh->x11auth)	x11_free_auth(ssh->x11auth);    sfree(ssh->do_ssh_init_state);    sfree(ssh->do_ssh1_login_state);    sfree(ssh->do_ssh2_transport_state);    sfree(ssh->do_ssh2_authconn_state);    if (ssh->crcda_ctx) {	crcda_free_context(ssh->crcda_ctx);	ssh->crcda_ctx = NULL;    }    if (ssh->s)	ssh_do_close(ssh);    expire_timer_context(ssh);    if (ssh->pinger)	pinger_free(ssh->pinger);    sfree(ssh);    random_unref();}