function returns dynamically allocated string that contains the list of users stored in linked list curr. I get the error that list is used unitialized
char* list_users(const User *curr) {
    // First loop until curr is NULL to find the total number of chars to allocate
    int list_len = 0;
    while (curr != NULL) {
        list_len += strlen(curr->name) + 2;    // +2 for tab and new line
        curr = curr->next;
    }
    list_len += 1;   // +1 for null terminator
    list_len += 10;  // +10 for "User List\n"

    char *list = malloc(list_len * sizeof(char));

    strcat(list, "User List\n");
    while (curr != NULL) {
        strcat(list, "\t");
        strcat(list, curr->name);
        strcat(list, "\n");
        curr = curr->next;
    }

    return list;
}