[libvirt] [PATCH] Fixed NULL pointer check

Wen Congyang wency at cn.fujitsu.com
Mon Mar 19 07:43:52 UTC 2012


At 03/18/2012 08:29 AM, Martin Kletzander Wrote:
> This patch fixes a NULL pointer check that was causing SegFault on
> some specific configurations.
> ---
>  src/util/conf.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/src/util/conf.c b/src/util/conf.c
> index 8ad60e0..e76362c 100644
> --- a/src/util/conf.c
> +++ b/src/util/conf.c
> @@ -1,7 +1,7 @@
>  /**
>   * 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
>   *
> @@ -836,6 +836,9 @@ virConfGetValue(virConfPtr conf, const char *setting)
>  {
>      virConfEntryPtr cur;
> 
> +    if (conf == NULL)
> +        return(NULL);

Please use 'return NULL;' instead of 'return(NULL);'

'return(NULL);' is old style, and we donot use it now and later.

> +
>      cur = conf->entries;
>      while (cur != NULL) {
>          if ((cur->name != NULL) &&

ACK with the nit fixed.

Wen Congyang




More information about the libvir-list mailing list