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

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;

int make_post(const User *author, User *target, char *contents) {
    int i;
    for(i = 0; i < MAX_FRIENDS; i++){
        if((target->friends)[i] == author){
            Post *pst = malloc(sizeof(Post));
            strncpy(pst->author, author->name, MAX_NAME);
            pst->contents = contents;
            time_t now;
            time(&now);
            pst->date = &now;

            pst->next = target->first_post;
            target->first_post = pst;
        }
    }
    return -1;
}
int create_user(const char *name, User **user_ptr_add) {
    if(strlen(name) > MAX_NAME){
        return 2;
    }

    User *add = malloc(sizeof(User));
    strcpy(add->name, name);

    if(*user_ptr_add == NULL){
        *user_ptr_add = add;
        return 0;
    }

    User *curr = *user_ptr_add;

    while(curr->next != NULL){
        if (strcmp(curr->name, name) == 0){
            return 1;
        }
        curr = curr->next;
    }

    if (strcmp(curr->name, name) != 0){
        curr->next = add;
    }
    else{
        return -1;
    }

    return 0;
}

int delete_user(const char *name, User **user_ptr_del) {
    User *target = *user_ptr_del;
    while(target != NULL){
        if (strcmp(target->name, name) == 0){
            int i;
            for(i = 0; i < MAX_FRIENDS; i++){
                User *curr_friend = target->friends[i];
                int deleted = 0;
                int j;
                for(j = 0; j < (MAX_FRIENDS - 1); j++){
                    if(curr_friend->friends[j] == NULL){
                        break;
                    }

                    if (curr_friend->friends[j] == target || deleted == 1){
                        deleted = 1;
                        curr_friend->friends[j] = curr_friend->friends[j + 1];
                    }
                }
                curr_friend->friends[MAX_FRIENDS - 1] = NULL;
            }
            Post *curr_post = target->first_post;
            while(curr_post != NULL){
                free(curr_post->date);
            }

            free(target);
            return 0;
        }
        target = target->next;
    }
    return 1;
}
why is there a segmentation fault