lib: Don't access configuration if none is present

Commit e457d5ef2015e6106094b85f8bbd1582002edc4d adds ability to pass the
default URI using the client configuration file. If the file is not
present, it still accesses the NULL config object causing a segfault.

Caught running "make check".
This commit is contained in:
Peter Krempa 2012-03-15 17:10:22 +01:00
parent 362c3b33e6
commit 59d0c9801c

View File

@ -1085,7 +1085,8 @@ virConnectOpenResolveURIAlias(virConfPtr conf,
*uri = NULL; *uri = NULL;
if ((value = virConfGetValue(conf, "uri_aliases"))) if (conf &&
(value = virConfGetValue(conf, "uri_aliases")))
ret = virConnectOpenFindURIAliasMatch(value, alias, uri); ret = virConnectOpenFindURIAliasMatch(value, alias, uri);
else else
ret = 0; ret = 0;