Fix memory leak warning

Xcode warns about possible leak of colorSpace. Moving the CGColorSpaceRelease(colorSpace) outside the if statement removes this warning.