aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/virsh.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/virsh.c b/tools/virsh.c
index 78a5c5b4a..0ea1930e4 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -6796,6 +6796,12 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
/* Determine the number of volumes in the pool */
numVolumes = virStoragePoolNumOfVolumes(pool);
+ if (numVolumes < 0) {
+ vshError(ctl, "%s", _("Failed to list storage volumes"));
+ virStoragePoolFree(pool);
+ return FALSE;
+ }
+
/* Retrieve the list of volume names in the pool */
if (numVolumes > 0) {
activeNames = vshCalloc(ctl, numVolumes, sizeof(*activeNames));