Why is this code creating a segmentation fault
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;
    }

    int not_detected = 1;
    for(int i = 0; i < MAX_FRIENDS; i++){
        if(strcmp(author->friends[i]->name, target->name) == 0){
            not_detected = 0;
            break;
        }
    }

    if(not_detected == 1){
        return not_detected;
    }
    else{
        Post *new_post = malloc(sizeof(Post));
        strcpy(new_post->author, author->name);
        strcpy(new_post->contents, contents);
        new_post->date = malloc(sizeof(time_t));
        *new_post->date = time(NULL);
        new_post->next = target->first_post;
        target->first_post = new_post;
        return 0;
    }

    return -1;
}
