Fix a small memory leak when using CALayer mode