Why does this code segmentation fault? 
int make_friends(const char *name1, const char *name2, User *head) {
        User *user1 = find_user(name1, head);
        User *user2 = find_user(name2, head);
        if (user1 == NULL || user2 == NULL){
                return 4;
        } else if (strcmp(name1, name2) == 0) {
                return 3;
        } else if (num_friends(user1) == MAX_FRIENDS || num_friends(user2) == MAX_FRIENDS){
                return 2;
        } else if (already_friends(user1, user2) == 0) {
                return 1;
        }
        add_friend(user1, user2);
        add_friend(user2, user1);
        // create_user(name2, user1->friends);
        // create_user(name1, user2->friends);
        return 0;
}

/*
 * Add user2 to user1's friend list. 
 */
void add_friend(User *user1, User *user2){
        for (int i=0; i<MAX_FRIENDS; i++){
                if (user1->friends[i] == NULL){
                        user1->friends[i] = user2;
                        return;
                }
        }
}


/*
 * Return the number of friends user has. 
 */
int num_friends(User *user){
        int friends = 0;
        for (int i=0; i<MAX_FRIENDS; i++){
                if (user->friends[i] != NULL){
                        friends++;
                }
        }
        return friends;
        /* User *friend = *user->friends; 
        while (friend != NULL){
                friends++;
                friend = friend->next; 
        }
        return friends; */
}


int already_friends(User *user1, User *user2){
        for (int i=0; i<MAX_FRIENDS; i++){
                User *user2_friend = user2->friends[i];
                if (strcmp(user2_friend->name, user1->name) == 0){
                        return 0;
                }
        }
        return 1;
        /* User *user2_friend = *user2->friends; 
        while (user2_friend != NULL){
                if (strcmp(user2_friend->name, user1->name) == 0){
                        return 0;
                }
                user2_friend = user2_friend->next; 
        }
        return 1; */
}