Why am i getting a segmentation fault
int create_user(const char *name, User **user_ptr_add) {
    if (strlen(name) >= MAX_NAME){
        return 2;
    }
    while (*user_ptr_add != NULL){
        if (strncmp(name, (*user_ptr_add)->name, MAX_NAME) == 0){
            return 1;
        }
        if((*user_ptr_add)->next == NULL){
            break;
        }
        *user_ptr_add = (*user_ptr_add)->next;
    }
    User *new_user = malloc(sizeof(User));
    strncpy(new_user->name, name, MAX_NAME);
    new_user->name[MAX_NAME-1] = '\0';
    (*user_ptr_add)->next = new_user;

    return 0;