[linux-pam] Avoid leaking memory and dir handle on realloc failure.