Freeing memory for unusued graphics components (fixes #5).