Re: [PATCH v8 2/4] Add vbox_snapshot_conf struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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;
> +}
> +
> +/*

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]