summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ferlan <jferlan@redhat.com>2016-02-19 13:54:45 -0500
committerJohn Ferlan <jferlan@redhat.com>2016-02-25 11:52:49 -0500
commit4e87164306f4bead094429ab9e520dfd1b58199f (patch)
tree7a7fed423b65c1305eac3e6be22e79829c1519b8
parentfe0063685a67ddebe5d56c95d5c13f1bb26813b7 (diff)
downloadlibvirt-4e87164306f4bead094429ab9e520dfd1b58199f.tar.gz
zfs: Resolve RESOURCE_LEAK
Found by my Coverity checker - virCheckFlags call could return -1, but not virCommandFree(destroy_cmd). Signed-off-by: John Ferlan <jferlan@redhat.com>
-rw-r--r--src/storage/storage_backend_zfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backend_zfs.c
index 6bf79634e1..4d04c70354 100644
--- a/src/storage/storage_backend_zfs.c
+++ b/src/storage/storage_backend_zfs.c
@@ -355,10 +355,12 @@ virStorageBackendZFSDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
unsigned int flags)
{
int ret = -1;
- virCommandPtr destroy_cmd = virCommandNewArgList(ZFS, "destroy", NULL);
+ virCommandPtr destroy_cmd = NULL;
virCheckFlags(0, -1);
+ destroy_cmd = virCommandNewArgList(ZFS, "destroy", NULL);
+
virCommandAddArgFormat(destroy_cmd, "%s/%s",
pool->def->source.name, vol->name);