Why am I getting segmentation faults?
/*
 * Returns the first empty index in the friends list of the user that passed in
 *
 * Return:
 *   - first empty index if such an index exists
 *   - -1 if the friends list has not empty spots
 */
int first_empty_friends_index(const User *user) {
    // iterating through both friends lists to see if they are already friends and if both friends have available spots
    // in their friends lists
    int friend_array_index;
    for (friend_array_index = 0; friend_array_index < MAX_FRIENDS; friend_array_index++) {
        if ((user->friends)[friend_array_index] == NULL) {
            return friend_array_index;
        }
    }
    return -1;
}

/*
 * Returns the first empty index in the friends list of the user that passed in
 *
 * Return:
 *   - the index of the second user in the first user's friends list
 *   - -1 if the second user is not in the first user's friends list
 */
int find_friend_index(const User *first_user, const User *second_user) {
    // iterating through first user's friends lists to see they are friends with the second user
    int friend_index;
    for (friend_index = 0; friend_index < MAX_FRIENDS; friend_index++) {
        if ((first_user->friends)[friend_index] != NULL) {
            if (strcmp(((first_user->friends)[friend_index])->name, second_user->name) == 0) {
                return friend_index; // return 1 if the users are already friends
            }
        }
    }
    return -1;
}

/*
 * From the list pointed to by *user_ptr_del, delete the user
 * with the given name.
 * Remove the deleted user from any lists of friends.
 *
 * Return:
 *   - 0 on success.
 *   - 1 if a user with this name does not exist.
 */
int delete_user(const char *name, User **user_ptr_del) {
    User *deleted_user = find_user(name, *user_ptr_del);
    if (deleted_user == NULL) {
        return 1;
    }

    User *curr_user = *user_ptr_del;
    User *prev_user = NULL;

    while (curr_user != NULL) {
        if (strcmp(name, curr_user->name) == 0) {
            // deleting the user from the linked list and freeing up the allocated memory
            if (prev_user != NULL) {
                // if curr has a previous element, make its previous point to its next
                prev_user->next = (curr_user->next)->next;
                curr_user = prev_user->next;
            } else {
                // if curr is the element at the head, make its next element the new head
                *user_ptr_del = curr_user->next;
                curr_user = *user_ptr_del;
            }

            Post *curr_post = curr_user->first_post;
            // deleting and freeing the user's posts in memory
            while (curr_post != NULL) {
                Post *post_copy = curr_post;
                curr_post = curr_post->next;
                free(post_copy->contents);
                free(post_copy->date);
                free(post_copy);
            }
        } else {
            int friend_index = find_friend_index(deleted_user, curr_user);
            if (friend_index != -1) { // checks if the users are friends
                (curr_user->friends)[friend_index] = NULL;
                // sets the index old the deleted user in the user's friends list to NULL
            }
        }
        curr_user = curr_user->next;
    }

    free(deleted_user);

    return 0;
}
