config: fix some common issues with path() usage
None of the callers check that the allocation in path() failed, so let's
check in path() and abort instead of failing.
Along those lines, none of the callers seem to acknowledge that the
returned string needs to be free()d -- let's do that as well. There are
a couple not addressed in this commit that will be addressed in a future
commit by pushing the path() call down into moveifchanged() instead and
freeing it properly there.
CID: 1505271, 1505250, 1505279
Reviewed by: emaste, imp