render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
43fe83
From 77e8976b4c8127438dc0351dbaad8f762ec899cb Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <77e8976b4c8127438dc0351dbaad8f762ec899cb.1377873641.git.jdenemar@redhat.com>
43fe83
From: Michal Privoznik <mprivozn@redhat.com>
43fe83
Date: Wed, 28 Aug 2013 10:24:11 +0200
43fe83
Subject: [PATCH] virsh-pool.c: Don't jump over variable declaration
43fe83
43fe83
https://bugzilla.redhat.com/show_bug.cgi?id=1001957
43fe83
43fe83
Since 785ff34bf8 we are using the outputStr variable in cleanup label.
43fe83
However, there is a possibility to jump to the label before the variable
43fe83
has been declared:
43fe83
43fe83
virsh-pool.c: In function 'cmdPoolList':
43fe83
virsh-pool.c:1121:25: error: jump skips variable initialization [-Werror=jump-misses-init]
43fe83
                         goto asprintf_failure;
43fe83
                         ^
43fe83
virsh-pool.c:1308:1: note: label 'asprintf_failure' defined here
43fe83
 asprintf_failure:
43fe83
 ^
43fe83
virsh-pool.c:1267:11: note: 'outputStr' declared here
43fe83
     char *outputStr = NULL;
43fe83
(cherry picked from commit 2ab0948d0c7034dbb3ee00e41cb497c03d0d2c66)
43fe83
---
43fe83
 tools/virsh-pool.c | 2 +-
43fe83
 1 file changed, 1 insertion(+), 1 deletion(-)
43fe83
43fe83
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
43fe83
index e31e76c..e52d676 100644
43fe83
--- a/tools/virsh-pool.c
43fe83
+++ b/tools/virsh-pool.c
43fe83
@@ -964,6 +964,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
43fe83
     const char *type = NULL;
43fe83
     bool details = vshCommandOptBool(cmd, "details");
43fe83
     bool inactive, all;
43fe83
+    char *outputStr = NULL;
43fe83
 
43fe83
     inactive = vshCommandOptBool(cmd, "inactive");
43fe83
     all = vshCommandOptBool(cmd, "all");
43fe83
@@ -1264,7 +1265,6 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
43fe83
     /* Create the output template.  Each column is sized according to
43fe83
      * the longest string.
43fe83
      */
43fe83
-    char *outputStr = NULL;
43fe83
     ret = virAsprintf(&outputStr,
43fe83
               "%%-%lus  %%-%lus  %%-%lus  %%-%lus  %%%lus  %%%lus  %%%lus\n",
43fe83
               (unsigned long) nameStrLength,
43fe83
-- 
43fe83
1.8.3.2
43fe83