[attributedlabel] Safety checks before calling CFRelease.

Closes #521.