Added destructors for leaves and non-leaves to free dynamically allocated mem