Fix memory leaks on all integration tests so far