why is there an infinite loop in my code
int delete_user(const char *name, User **user_ptr_del) {
    // find the user
    User *user_to_del = find_user(name, *user_ptr_del);
    if (user_to_del == NULL){
        // user not found
        return 1;
    }
    printf("hello1"); // TESTING
    // fflush(stdout);

    // user exists
    // loop through and delete the user from their friend's list
    User *curr_user = *user_ptr_del;

    // go through each user and delete the user from friend list
    while (curr_user != NULL){
        printf("hello2"); // TESTING
        // fflush(stdout); // TESTING
        int i;
        for (i=0; i < MAX_FRIENDS; i++){
            if ((curr_user->friends)[i] == user_to_del){
                printf("%d", i); // TESTING
                // found the user to delete in friend's list, shift the position of other friends in the list
                int j;
                for (j=i; j < (MAX_FRIENDS - 1); j++){
                    (curr_user->friends)[j] = (curr_user->friends)[j + 1]; 
                    printf("%d", j); // TESTING
                }
                // shift the last friend - must be NULL 
                (curr_user->friends)[MAX_FRIENDS - 1] = NULL;
            }
        }
        curr_user = curr_user->next;
    }

    // deallocate memory associated with user's posts
    Post *post = user_to_del->first_post;
    while(post != NULL){
        user_to_del->first_post = post->next;
        free(post->date);
        free(post->contents);
        free(post);
        post = user_to_del->first_post;
    }

    // find the user and delete
    curr_user = *user_ptr_del;
    if (curr_user == user_to_del){
        // user to delete is the first user
        *user_ptr_del = user_to_del->next;
        free(user_to_del);
        return 0;
    }
    while (curr_user->next != NULL){
        if (curr_user->next == user_to_del){
            // found user to delete
            curr_user->next = user_to_del->next;
            // free memory for user
            free(user_to_del);
            return 0;
        }
    } 
    return 0;
}