[libvirt] [PATCH] test.c: don't use undefined local, "def"

Daniel P. Berrange berrange at redhat.com
Thu Sep 3 10:35:32 UTC 2009


On Thu, Sep 03, 2009 at 12:13:00PM +0200, Jim Meyering wrote:
> another real bug:
> 
> >From fd41bd47252654f84684830e02ecbeb3d26e7dee Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Thu, 3 Sep 2009 12:12:19 +0200
> Subject: [PATCH] test.c: don't use undefined local, "def"
> 
> * src/test.c (testOpenVolumesForPool): Upon early virAsprintf or
> virXPathNodeSet failure, "goto error" would take us to
> virStorageVolDefFree(def), but with "def" not defined.
> Initialize it to NULL.
> ---
>  src/test.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/test.c b/src/test.c
> index 7c8f85b..895cce1 100644
> --- a/src/test.c
> +++ b/src/test.c
> @@ -435,7 +435,7 @@ static int testOpenVolumesForPool(virConnectPtr conn,
>      char *vol_xpath;
>      int i, ret, func_ret = -1;
>      xmlNodePtr *vols = NULL;
> -    virStorageVolDefPtr def;
> +    virStorageVolDefPtr def = NULL;
> 
>      /* Find storage volumes */
>      if (virAsprintf(&vol_xpath, "/node/pool[%d]/volume", poolidx) < 0) {

ACK

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list