#include <time.h>

#define MAX_NAME 32     // Max username and profile_pic filename lengths
#define MAX_FRIENDS 10  // Max number of friends a user can have

typedef struct user {
    char name[MAX_NAME];
    char profile_pic[MAX_NAME];  // This is a *filename*, not the file contents.
    struct post *first_post;
    struct user *friends[MAX_FRIENDS];
    struct user *next;
} User;

typedef struct post {
    char author[MAX_NAME];
    char *contents;
    time_t *date;
    struct post *next;
} Post;

int make_post(const User *author, User *target, char *contents) {
    if (author == NULL || target == NULL) {
        return 2;
    } else {

        // Create and allocate a new post.
        Post* new_post = malloc(sizeof(Post));

        // Check if memory allocation was successful; exits if not.
        if (new_post == NULL) {
            exit(1);
        }

        // Check if users are friends
        if (check_friends((User*) author, target) == 0) {

                strcpy(new_post->author, author->name);
                strcpy(new_post->contents, contents);

                // Grab the date.
                time_t date = time(NULL);
                time(&date);
                new_post->date = &date;

                // Change the posts in author's struct.
                Post* old_post = target->first_post;
                if (old_post == NULL) {
                    target->first_post = new_post;
                    target->next = NULL;
                } else {
                    target->first_post = new_post;
                    new_post->next = old_post;
                }

                return 0;

        } else {

            free(new_post);
            return 1;

        }

    }
}
/*
 * Make a new post from 'author' to the 'target' user,
 * containing the given contents, IF the users are friends.
 *
 * Insert the new post at the *front* of the user's list of posts.
 *
 * 'contents' is a pointer to heap-allocated memory - you do not need
 * to allocate more memory to store the contents of the post.
 *
 * Return:
 *   - 0 on success
 *   - 1 if users exist but are not friends
 *   - 2 if either User pointer is NULL
 */

I am currently getting a segmentation fault (core dumped).