mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
virsh-pool.c: Don't jump over variable declaration
Since 785ff34bf8
we are using the outputStr variable in cleanup label.
However, there is a possibility to jump to the label before the variable
has been declared:
virsh-pool.c: In function 'cmdPoolList':
virsh-pool.c:1121:25: error: jump skips variable initialization [-Werror=jump-misses-init]
goto asprintf_failure;
^
virsh-pool.c:1308:1: note: label 'asprintf_failure' defined here
asprintf_failure:
^
virsh-pool.c:1267:11: note: 'outputStr' declared here
char *outputStr = NULL;
This commit is contained in:
parent
14d5328681
commit
2ab0948d0c
@ -964,6 +964,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
|||||||
const char *type = NULL;
|
const char *type = NULL;
|
||||||
bool details = vshCommandOptBool(cmd, "details");
|
bool details = vshCommandOptBool(cmd, "details");
|
||||||
bool inactive, all;
|
bool inactive, all;
|
||||||
|
char *outputStr = NULL;
|
||||||
|
|
||||||
inactive = vshCommandOptBool(cmd, "inactive");
|
inactive = vshCommandOptBool(cmd, "inactive");
|
||||||
all = vshCommandOptBool(cmd, "all");
|
all = vshCommandOptBool(cmd, "all");
|
||||||
@ -1264,7 +1265,6 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
|||||||
/* Create the output template. Each column is sized according to
|
/* Create the output template. Each column is sized according to
|
||||||
* the longest string.
|
* the longest string.
|
||||||
*/
|
*/
|
||||||
char *outputStr = NULL;
|
|
||||||
ret = virAsprintf(&outputStr,
|
ret = virAsprintf(&outputStr,
|
||||||
"%%-%lus %%-%lus %%-%lus %%-%lus %%%lus %%%lus %%%lus\n",
|
"%%-%lus %%-%lus %%-%lus %%-%lus %%%lus %%%lus %%%lus\n",
|
||||||
(unsigned long) nameStrLength,
|
(unsigned long) nameStrLength,
|
||||||
|
Loading…
Reference in New Issue
Block a user