if (ssh->pktout.data) { sfree(ssh->pktout.data); ssh->pktout.data = NULL; } if (ssh->pktin.data) { sfree(ssh->pktin.data); ssh->pktin.data = NULL; } if (ssh->crcda_ctx) { crcda_free_context(ssh->crcda_ctx); ssh->crcda_ctx = NULL; } if (ssh->logctx) { log_free(ssh->logctx); ssh->logctx = NULL; }
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)	ssh->cscomp->compress_cleanup(ssh->cs_comp_ctx);    if (ssh->sc_comp_ctx)	ssh->sccomp->compress_cleanup(ssh->sc_comp_ctx);    if (ssh->kex_ctx)	dh_cleanup(ssh->kex_ctx);    sfree(ssh->savedhost);    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);    }    if (ssh->rportfwds) {	while ((pf = delpos234(ssh->rportfwds, 0)) != NULL)	    sfree(pf);	freetree234(ssh->rportfwds);    }    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->s)	ssh_do_close(ssh);    sfree(ssh);}