I want to save the contents of username in the heap using malloc. is this correct?
client->username = malloc(sizeof(char) * (strlen(username) + 1));
client->username[strlen(username)] = '\0';
strncpy(client->username, username, strlen(username) + 1);