I can't seem for the life of me figure out what the is wrong with my code in the deletion of a whole BST.
I figure since there doesn't seem to be a problem with this:
void emptyTree(BST **root){ 
    if((*root)!=NULL){
        emptyTree(&(*root)->left);
        emptyTree(&(*root)->right);
        free(*root);
    }
}
Then the whole problem lies with the initial entry of each node in the tree. Can anyone point out what's wrong here?
void insertNode(BST **root, BST *temp){
    if((*root)!=NULL){
        temp->parent = *root;   
        if(((*root)->value) < (temp->value))    
            insertNode(&(*root)->right,temp);
        else if(((*root)->value) > (temp->value)) 
            insertNode(&(*root)->left,temp);
        else if(((*root)->value) == (temp->value)){ 
            printf("The number %i is already in the tree.\n",temp->value);  
            return;
        }
    } else {
        *root = temp;
        printf("%i was added to the tree.\n",temp->value);
        return;
    }
}
void newNode(BST **root, int x){
    BST *newnode;
    newnode = (BST *)malloc(sizeof(BST));
    newnode->value = x;
    newnode->left = newnode->right = newnode->parent = NULL;
    insertNode(root,newnode);
} 
It compiles, it runs, it does absolutely every function right(including one that deletes one node at a time). Except the 'Delete All'(emptyTree) one. It doesn't delete everything(?). It doesn't even show an error when I run through the emptyTree function. It only errors when I printf the whole tree.
 
    