Why does this function segmentation fault
int make_post(const User *author, User *target, char *contents) {
    if (author == NULL || target == NULL) {
        return 2;
    }
    int success = 1;
    for (int i = 0; i < MAX_FRIENDS; i++) {
        if (target->friends[i] != NULL && strcmp(target->friends[i]->name, author->name) == 0) {
            success = 0;
        }
    }
    
    if (success == 0) {
        Post *new_post = malloc(sizeof(Post));
        new_post->date = malloc(sizeof(time_t));
        strncpy(new_post->author, author->name, strlen(author->name) + 1);
        strncpy(new_post->contents, contents, strlen(contents) + 1);
        *(new_post->date) = time(NULL);
        new_post->next = target->first_post;
        target->first_post = new_post;
    }

    return success;
}