Fix memory leak in MaskEffect