how to fix the memory leak
/* 
 * Make two users friends with each other.  This is symmetric - a pointer to 
 * each user must be stored in the 'friends' array of the other. 
 * 
 * New friends must be added in the first empty spot in the 'friends' array. 
 * 
 * Return: 
 *   - 0 on success. 
 *   - 1 if the two users are already friends. 
 *   - 2 if the users are not already friends, but at least one already has 
 *     MAX_FRIENDS friends. 
 *   - 3 if the same user is passed in twice. 
 *   - 4 if at least one user does not exist. 
 * 
 * Do not modify either user if the result is a failure. 
 * NOTE: If multiple errors apply, return the *largest* error code that applies. 
 */  
int make_friends(const char *name1, const char *name2, User *head){ 
    // struct user *friends[MAX_FRIENDS]; an array of users?

    int error = -1;

    // Case 3 if the same user is passed in twice.
    if(strcmp(name1, name2)==0){
        error = 3;
    }

    // Case 4 if at least one user does not exist. 
    User *user1 = find_user(name1, head);
    User *user2 = find_user(name2, head);

    if(user1 == NULL || user2 == NULL){
        return 4;
    }

    // Case 1 if the two users are already friends
    for(int i = 0;i < 9; i ++){
        if(user1->friends[i]->name == name2){
           if(0 > error){
            error = 1;
           }
          // Case 2 if the users are not already friends, but at least one already has 
        // MAX_FRIENDS friends. 
        }
        if(user1->friends[9] != NULL || user2->friends[9] != NULL){
            if(1 > error){
                return 2;
            }
        }else{
            error = 0;
        }
    }

    int done1 = 0;
    int done2 = 0;

    if(error == 0){
    // Case 0 make them friends
        for(int i = 0; i < 9; i++){
            if(done1 == 0){
                if(user1->friends[i] == NULL){
                    user1->friends[i] = user2; 
                }
                done1 = 1;
            }
            if(done2 == 0){
                if(user2->friends[i] == NULL){
                    user2->friends[i] = user1; 
                }
                done2 = 1;
            }
            fprintf(stdout, "%s\n",user1->friends[i]->name);
            fprintf(stdout, "%s\n",user2->friends[i]->name);
        }
    }

    return error;    
}