1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-13 17:18:01 +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 static bool
virStorageFileSupportsBackingChainTraversal(virStorageSourcePtr src) virStorageFileSupportsBackingChainTraversal(virStorageSourcePtr src)
{ {
int actualType = virStorageSourceGetActualType(src); int actualType;
virStorageFileBackendPtr backend; virStorageFileBackendPtr backend;
if (!src) if (!src)
return false; return false;
actualType = virStorageSourceGetActualType(src);
if (src->drv) { if (src->drv) {
backend = src->drv->backend; backend = src->drv->backend;
@ -2473,11 +2474,12 @@ virStorageFileSupportsBackingChainTraversal(virStorageSourcePtr src)
bool bool
virStorageFileSupportsSecurityDriver(virStorageSourcePtr src) virStorageFileSupportsSecurityDriver(virStorageSourcePtr src)
{ {
int actualType = virStorageSourceGetActualType(src); int actualType;
virStorageFileBackendPtr backend; virStorageFileBackendPtr backend;
if (!src) if (!src)
return false; return false;
actualType = virStorageSourceGetActualType(src);
if (src->drv) { if (src->drv) {
backend = src->drv->backend; backend = src->drv->backend;