KAA-235: Fix memory leak in tests.