One more here too - missed it in my last pass...
On 05/19/2014 08:47 AM, Yohan BELLEGUIC wrote:
<...snip...>
+
+/*
+ *isCurrentSnapshot: Return 1 if 'snapshotName' corresponds to the
+ *vboxSnapshotXmlMachinePtr's current snapshot, return 0 otherwise.
+ */
+int virVBoxSnapshotConfIsCurrentSnapshot(virVBoxSnapshotConfMachinePtr machine, char
*snapshotName)
+{
+ virVBoxSnapshotConfSnapshotPtr snapshot = NULL;
+ if (machine == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Machine is null"));
+ goto cleanup;
+ }
+ if (snapshotName == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("snapshotName is null"));
+ goto cleanup;
+ }
+ snapshot = virVBoxSnapshotConfSnapshotByName(machine->snapshot, snapshotName);
Coverity complains:
(5) Event returned_null: "virVBoxSnapshotConfSnapshotByName" returns
null (checked 4 out of 5 times). [details]
(14) Event var_assigned: Assigning: "snapshot" = null return value from
"virVBoxSnapshotConfSnapshotByName".
You will need a:
if (snapshot == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to find the snapshot %s"), snapshotName);
goto cleanup;
}
+ return STREQ(snapshot->uuid, machine->currentSnapshot);
(15) Event dereference: Dereferencing a null pointer "snapshot".
+
+ cleanup:
+ return 0;
+}
+
+/*