[server][testDataStoreFactory] Fix a potential problem that might leak a memory.