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:
Michael Chapman 2014-02-12 22:05:51 +11:00 committed by Ján Tomko
parent 7236a473f0
commit 74cf8202d2

View File

@ -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++;