int make_post(const User *author, User *target, char *contents) {

    if (author == NULL || target == NULL) {
        return 2;
    }
    bool is_friends = false;
    for (int i = 0; i < MAX_FRIENDS; i++) {
        if (target->friends[i] == author) {
            is_friends = true;
            break;
        }
    }

    if (!is_friends) {
        return 1;
    }

    Post *new_post = (Post *)malloc(sizeof(Post));
    strncpy(new_post->author, author->name, MAX_NAME - 1);
    new_post->author[MAX_NAME - 1] = '\0';
    new_post->contents = contents;
    new_post->date = (time_t *)malloc(sizeof(time_t));
    time(new_post->date);

    new_post->next = target->first_post;
    target->first_post = new_post;

    free(new_post->date);
    free(new_post);

    return 0;
}
Free the memory correctly