mirror of https://gitee.com/openkylin/libvirt.git
storage: handle NULL return from virGetStorageVol
virGetStorageVol can return NULL on out-of-memory. If it does, cleanly abort the volume clone operation. Signed-off-by: Michael Chapman <mike@very.puzzling.org>
This commit is contained in:
parent
7236a473f0
commit
74cf8202d2
|
@ -1828,6 +1828,10 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
|
|||
pool->volumes.objs[pool->volumes.count++] = newvol;
|
||||
volobj = virGetStorageVol(obj->conn, pool->def->name, newvol->name,
|
||||
newvol->key, NULL, NULL);
|
||||
if (!volobj) {
|
||||
pool->volumes.count--;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Drop the pool lock during volume allocation */
|
||||
pool->asyncjobs++;
|
||||
|
|
Loading…
Reference in New Issue