Check for NULL before freeing passwordBytes