In the first if case, virGetUserEnt() isn't necessary so don't bother
calling it before determining we need it.
{
const char *path = getenv(xdgenvname);
char *ret = NULL;
- char *home = virGetUserEnt(geteuid(), VIR_USER_ENT_DIRECTORY);
+ char *home = NULL;
if (path && path[0]) {
if (virAsprintf(&ret, "%s/libvirt", path) < 0)
goto no_memory;
} else {
+ home = virGetUserEnt(geteuid(), VIR_USER_ENT_DIRECTORY);
if (virAsprintf(&ret, "%s/%s/libvirt", home, xdgdefdir) < 0)
goto no_memory;
}