vbox_snapshot_conf: Resolve Coverity warnings
Clean up some Coverity warnings from commit id '4dc5d8f1'
This commit is contained in:
parent
70bd552e67
commit
fdfdbc0d12
@ -1257,6 +1257,11 @@ virVBoxSnapshotConfIsCurrentSnapshot(virVBoxSnapshotConfMachinePtr machine,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
snapshot = virVBoxSnapshotConfSnapshotByName(machine->snapshot, snapshotName);
|
snapshot = virVBoxSnapshotConfSnapshotByName(machine->snapshot, snapshotName);
|
||||||
|
if (snapshot == NULL) {
|
||||||
|
virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
|
||||||
|
_("Unable to find the snapshot %s"), snapshotName);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
return STREQ(snapshot->uuid, machine->currentSnapshot);
|
return STREQ(snapshot->uuid, machine->currentSnapshot);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -1274,7 +1279,7 @@ virVBoxSnapshotConfGetRWDisksPathsFromLibvirtXML(const char *filePath,
|
|||||||
{
|
{
|
||||||
int result = -1;
|
int result = -1;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
char **ret;
|
char **ret = NULL;
|
||||||
xmlDocPtr xml = NULL;
|
xmlDocPtr xml = NULL;
|
||||||
xmlXPathContextPtr xPathContext = NULL;
|
xmlXPathContextPtr xPathContext = NULL;
|
||||||
xmlNodePtr *nodes = NULL;
|
xmlNodePtr *nodes = NULL;
|
||||||
@ -1296,7 +1301,9 @@ virVBoxSnapshotConfGetRWDisksPathsFromLibvirtXML(const char *filePath,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
xPathContext->node = xmlDocGetRootElement(xml);
|
xPathContext->node = xmlDocGetRootElement(xml);
|
||||||
nodeSize = virXPathNodeSet("/domainsnapshot/disks/disk", xPathContext, &nodes);
|
if ((nodeSize = virXPathNodeSet("/domainsnapshot/disks/disk",
|
||||||
|
xPathContext, &nodes)) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(ret, nodeSize) < 0)
|
if (VIR_ALLOC_N(ret, nodeSize) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1315,13 +1322,12 @@ virVBoxSnapshotConfGetRWDisksPathsFromLibvirtXML(const char *filePath,
|
|||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
xmlXPathFreeContext(xPathContext);
|
xmlXPathFreeContext(xPathContext);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
for (i = 0; i < nodeSize; i++)
|
virStringFreeList(ret);
|
||||||
VIR_FREE(ret[i]);
|
|
||||||
VIR_FREE(ret);
|
|
||||||
nodeSize = -1;
|
nodeSize = -1;
|
||||||
} else {
|
} else {
|
||||||
*rwDisksPath = ret;
|
*rwDisksPath = ret;
|
||||||
}
|
}
|
||||||
|
VIR_FREE(nodes);
|
||||||
return nodeSize;
|
return nodeSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1357,9 +1363,10 @@ virVBoxSnapshotConfGetRODisksPathsFromLibvirtXML(const char *filePath,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
xPathContext->node = xmlDocGetRootElement(xml);
|
xPathContext->node = xmlDocGetRootElement(xml);
|
||||||
nodeSize = virXPathNodeSet("/domainsnapshot/domain/devices/disk",
|
if ((nodeSize = virXPathNodeSet("/domainsnapshot/domain/devices/disk",
|
||||||
xPathContext,
|
xPathContext,
|
||||||
&nodes);
|
&nodes)) < 0)
|
||||||
|
goto cleanup;
|
||||||
if (VIR_ALLOC_N(ret, nodeSize) < 0)
|
if (VIR_ALLOC_N(ret, nodeSize) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -1379,8 +1386,10 @@ virVBoxSnapshotConfGetRODisksPathsFromLibvirtXML(const char *filePath,
|
|||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
virStringFreeList(ret);
|
virStringFreeList(ret);
|
||||||
nodeSize = -1;
|
nodeSize = -1;
|
||||||
|
} else {
|
||||||
|
*roDisksPath = ret;
|
||||||
}
|
}
|
||||||
*roDisksPath = ret;
|
VIR_FREE(nodes);
|
||||||
return nodeSize;
|
return nodeSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user