the code is supposed to create a string name from the contents of username and allocate memory in the heap. However, when I run the code through gdb, name = "". What is causing this error?
char *name = malloc(sizeof(char) * (strlen(username) + 1));
name[strlen(username)] = '\0';
strncpy(client->username, name, strlen(name) + 1);