Fixed memory leaks when adding fiducials in unit test