test-replication: fix leaks