xrealloc_getcwd_or_warn: smaller cod and less wasted RAM at run time