[libvirt] [PATCH] lib: Don't access configuration if none is present
Daniel P. Berrange
berrange at redhat.com
Thu Mar 15 16:37:49 UTC 2012
On Thu, Mar 15, 2012 at 05:22:28PM +0100, Peter Krempa wrote:
> 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".
> ---
> src/libvirt.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/src/libvirt.c b/src/libvirt.c
> index 1c0cdf7..d0b1b28 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -1085,7 +1085,8 @@ virConnectOpenResolveURIAlias(virConfPtr conf,
>
> *uri = NULL;
>
> - if ((value = virConfGetValue(conf, "uri_aliases")))
> + if (conf &&
> + (value = virConfGetValue(conf, "uri_aliases")))
> ret = virConnectOpenFindURIAliasMatch(value, alias, uri);
> else
> ret = 0;
ACK
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list