提交 3992cfdd 编写于 作者: M Martin Kletzander 提交者: Michal Privoznik

virConfGetValue: Fixed NULL pointer check

This patch fixes a NULL pointer check that was causing SegFault on
some specific configurations. It also reverts commit 59d0c980
that was checking for this value in one place.
上级 787f4feb
...@@ -1085,8 +1085,7 @@ virConnectOpenResolveURIAlias(virConfPtr conf, ...@@ -1085,8 +1085,7 @@ virConnectOpenResolveURIAlias(virConfPtr conf,
*uri = NULL; *uri = NULL;
if (conf && if ((value = virConfGetValue(conf, "uri_aliases")))
(value = virConfGetValue(conf, "uri_aliases")))
ret = virConnectOpenFindURIAliasMatch(value, alias, uri); ret = virConnectOpenFindURIAliasMatch(value, alias, uri);
else else
ret = 0; ret = 0;
......
/** /**
* conf.c: parser for a subset of the Python encoded Xen configuration files * conf.c: parser for a subset of the Python encoded Xen configuration files
* *
* Copyright (C) 2006-2011 Red Hat, Inc. * Copyright (C) 2006-2012 Red Hat, Inc.
* *
* See COPYING.LIB for the License of this software * See COPYING.LIB for the License of this software
* *
...@@ -836,6 +836,9 @@ virConfGetValue(virConfPtr conf, const char *setting) ...@@ -836,6 +836,9 @@ virConfGetValue(virConfPtr conf, const char *setting)
{ {
virConfEntryPtr cur; virConfEntryPtr cur;
if (conf == NULL)
return NULL;
cur = conf->entries; cur = conf->entries;
while (cur != NULL) { while (cur != NULL) {
if ((cur->name != NULL) && if ((cur->name != NULL) &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册