fix a memory leak in readCredentials()