mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
storage: Fix coverity warning
Introduced by commit e0139e3044
:
1777 /* Updating pool metadata */
(40) Event var_deref_op: Dereferencing null pointer "newvol".
Also see events: [assign_zero]
1778 pool->def->allocation += newvol->allocation;
1779 pool->def->available -= newvol->allocation;
This commit is contained in:
parent
c753749c27
commit
b8a0103d45
@ -1635,6 +1635,7 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
|
|||||||
virStorageBackendPtr backend;
|
virStorageBackendPtr backend;
|
||||||
virStorageVolDefPtr origvol = NULL, newvol = NULL;
|
virStorageVolDefPtr origvol = NULL, newvol = NULL;
|
||||||
virStorageVolPtr ret = NULL, volobj = NULL;
|
virStorageVolPtr ret = NULL, volobj = NULL;
|
||||||
|
unsigned long long allocation;
|
||||||
int buildret;
|
int buildret;
|
||||||
|
|
||||||
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL);
|
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL);
|
||||||
@ -1758,6 +1759,7 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
|
|||||||
|
|
||||||
origvol->building = 0;
|
origvol->building = 0;
|
||||||
newvol->building = 0;
|
newvol->building = 0;
|
||||||
|
allocation = newvol->allocation;
|
||||||
newvol = NULL;
|
newvol = NULL;
|
||||||
pool->asyncjobs--;
|
pool->asyncjobs--;
|
||||||
|
|
||||||
@ -1775,8 +1777,8 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Updating pool metadata */
|
/* Updating pool metadata */
|
||||||
pool->def->allocation += newvol->allocation;
|
pool->def->allocation += allocation;
|
||||||
pool->def->available -= newvol->allocation;
|
pool->def->available -= allocation;
|
||||||
|
|
||||||
VIR_INFO("Creating volume '%s' in storage pool '%s'",
|
VIR_INFO("Creating volume '%s' in storage pool '%s'",
|
||||||
volobj->name, pool->def->name);
|
volobj->name, pool->def->name);
|
||||||
|
Loading…
Reference in New Issue
Block a user