1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-26 03:21:44 +03:00

storage_driver: Resolve Coverity REVERSE_INULL

There were two occurrances of attempting to initialize actualType by
calling virStorageSourceGetActualType(src) prior to a check if (!src)
resulting in Coverity complaining about the possible NULL dereference
in virStorageSourceGetActualType() of src.

Resolve by moving the actualType setting until after checking !src
This commit is contained in:
John Ferlan 2014-08-27 07:56:00 -04:00
parent cfbbeb36cf
commit bab35f7419

View File

@ -2441,11 +2441,12 @@ virStorageFileIsInitialized(virStorageSourcePtr src)
static bool
virStorageFileSupportsBackingChainTraversal(virStorageSourcePtr src)
{
int actualType = virStorageSourceGetActualType(src);
int actualType;
virStorageFileBackendPtr backend;
if (!src)
return false;
actualType = virStorageSourceGetActualType(src);
if (src->drv) {
backend = src->drv->backend;
@ -2473,11 +2474,12 @@ virStorageFileSupportsBackingChainTraversal(virStorageSourcePtr src)
bool
virStorageFileSupportsSecurityDriver(virStorageSourcePtr src)
{
int actualType = virStorageSourceGetActualType(src);
int actualType;
virStorageFileBackendPtr backend;
if (!src)
return false;
actualType = virStorageSourceGetActualType(src);
if (src->drv) {
backend = src->drv->backend;