Don't try to do other jobs if get cmd NULL.
Signed-off-by: Harry Wei <harryxiyou(a)gmail.com>
---
src/storage/storage_backend_sheepdog.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/storage/storage_backend_sheepdog.c
b/src/storage/storage_backend_sheepdog.c
index 218284d..1ce5aa4 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -120,6 +120,8 @@ virStorageBackendSheepdogRefreshPool(virConnectPtr conn
ATTRIBUTE_UNUSED,
virCommandPtr cmd;
cmd = virCommandNewArgList(COLLIE, "node", "info",
"-r", NULL);
+ if (cmd == NULL)
+ return -1;
virStorageBackendSheepdogAddHostArg(cmd, pool);
virCommandSetOutputBuffer(cmd, &output);
ret = virCommandRun(cmd, NULL);
@@ -142,6 +144,8 @@ virStorageBackendSheepdogDeleteVol(virConnectPtr conn
ATTRIBUTE_UNUSED,
virCheckFlags(0, -1);
virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "delete",
vol->name, NULL);
+ if (cmd == NULL)
+ return -1;
virStorageBackendSheepdogAddHostArg(cmd, pool);
int ret = virCommandRun(cmd, NULL);
@@ -165,6 +169,8 @@ virStorageBackendSheepdogCreateVol(virConnectPtr conn
ATTRIBUTE_UNUSED,
}
virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "create",
vol->name, NULL);
+ if (cmd == NULL)
+ return -1;
virCommandAddArgFormat(cmd, "%llu", vol->capacity);
virStorageBackendSheepdogAddHostArg(cmd, pool);
if (virCommandRun(cmd, NULL) < 0)
@@ -251,6 +257,8 @@ virStorageBackendSheepdogRefreshVol(virConnectPtr conn
ATTRIBUTE_UNUSED,
char *output = NULL;
virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "list",
vol->name, "-r", NULL);
+ if (cmd == NULL)
+ return -1;
virStorageBackendSheepdogAddHostArg(cmd, pool);
virCommandSetOutputBuffer(cmd, &output);
ret = virCommandRun(cmd, NULL);
@@ -293,6 +301,8 @@ virStorageBackendSheepdogResizeVol(virConnectPtr conn
ATTRIBUTE_UNUSED,
virCheckFlags(0, -1);
virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "resize",
vol->name, NULL);
+ if (cmd == NULL)
+ return -1;
virCommandAddArgFormat(cmd, "%llu", capacity);
virStorageBackendSheepdogAddHostArg(cmd, pool);
int ret = virCommandRun(cmd, NULL);
--
1.7.0.4