/*
 * 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 *wanted_user = find_user(name, *user_ptr_del);
    User *curr = *user_ptr_del;
    // Checks if the user was found 
    if (curr == NULL || wanted_user == NULL) {
        return 1;
    }
    // Traverse through friends list and remove user from all friends list 
    for (int i = 0; i < MAX_FRIENDS; i++) {
        if (wanted_user->friends[i] != NULL) {
            int prev = 0;
            // Go through their friend's list and remove them off of it
            for (int j = 0; j < MAX_FRIENDS; j++) {
                if (wanted_user->friends[i]->friends[j] != wanted_user) {
                    wanted_user->friends[i]->friends[prev] = wanted_user->friends[i]->friends[j];
                    prev +=1;
                }
            }
            
        }
    }
    // Switch pointers to remove user from user linked list 
    while (curr != NULL) {
        // If wanted_user is the head
        if (*user_ptr_del == wanted_user) {
            *user_ptr_del = curr->next;
        }
        // Have user point to the user beyond wanted_user
        else if ((curr->next != NULL) && curr->next == wanted_user){
            curr->next = curr->next->next;
        }
        curr = curr->next;
    } 

    // Free the user's post
    Post *curr_post = wanted_user->first_post;
    while (curr_post != NULL) {
        Post *new_post = curr_post->next;
        free(curr_post->contents);
        free(curr_post->date);
        free(curr_post);
        // Go to next post 
        curr_post = new_post;
    }

    // Free the user
    free(wanted_user);

    return 0;
}
How to free all memory?
