client->clientData = NULL;
static void client_gone(rfbClientPtr client) {	client_count--;	if (client_count < 0) client_count = 0;	speeds_net_rate_measured = 0;	speeds_net_latency_measured = 0;	rfbLog("client_count: %d\n", client_count);	if (no_autorepeat && client_count == 0) {		autorepeat(1, 0);	}	if (use_solid_bg && client_count == 0) {		solid_bg(1);	}	if (gone_cmd && *gone_cmd != '\0') {		rfbLog("client_gone: using cmd for: %s\n", client->host);		run_user_command(gone_cmd, client, "gone");	}	if (client->clientData) {		ClientData *cd = (ClientData *) client->clientData;		if (cd) {			if (cd->server_ip) {				free(cd->server_ip);			}			if (cd->hostname) {				free(cd->hostname);			}			if (cd->username) {				free(cd->username);			}		}		free(client->clientData);	}	if (inetd) {		rfbLog("viewer exited.\n");		clean_up_exit(0);	}	if (connect_once) {		/*		 * This non-exit is done for a bad passwd to be consistent		 * with our RFB_CLIENT_REFUSE behavior in new_client()  (i.e.		 * we disconnect after 1 successful connection).		 */		if ((client->state == RFB_PROTOCOL_VERSION ||		     client->state == RFB_AUTHENTICATION) && accepted_client) {			rfbLog("connect_once: invalid password or early "			   "disconnect.\n");			rfbLog("connect_once: waiting for next connection.\n"); 			accepted_client = 0;			return;		}		if (shared && client_count > 0)  {			rfbLog("connect_once: other shared clients still "			    "connected, not exiting.\n");			return;		}		rfbLog("viewer exited.\n");		clean_up_exit(0);	}}