[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



another real bug:

>From fd41bd47252654f84684830e02ecbeb3d26e7dee Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering 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) {
--
1.6.4.2.395.ge3d52


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]