Language: C
Label: safe
CWE: CWE-401 \u2014 Missing Release of Memory after Effective Lifetime
The product does not sufficiently track and release allocated memory after it has been used, which slowly consumes remaining memory.

Code:
_client_list_free_node(t_client *client)
{

	char *msg;
	char *cidinfo;

	if (client->cid) {

		// Remove any existing cidfile:
		if (strlen(client->cid) > 0) {
			msg = safe_calloc(SMALL_BUF);
			cidinfo = safe_calloc(MID_BUF);
			safe_snprintf(cidinfo, MID_BUF, "cid=\"%s\"", client->cid);
			write_client_info(msg, SMALL_BUF, "rmcid", client->cid, cidinfo);
			free(msg);
			free(cidinfo);
		}
	}

	free(client->token);
	free(client->hid);
	free(client->custom);
	free(client->client_type);
	free(client->cid);

	if (strcmp(client->cpi_query, "") == 0) {
		free(client->cpi_query);
	}

	free(client);
}