Clean up memory used for unit test

Refs #5977
Merge branch 'bugfix/5977_unit_equals_operator' into develop