Fix memory leak in Material.
Merge pull request #567 from AnalyticalGraphicsInc/destroyMaterial

Destroy sub-materials.