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

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

 



another real bug:

>From fd41bd47252654f84684830e02ecbeb3d26e7dee Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
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

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]