From: Michael Chapman Date: Wed, 12 Feb 2014 11:05:51 +0000 (+1100) Subject: storage: handle NULL return from virGetStorageVol X-Git-Tag: v1.2.2-rc1~123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74cf8202d2e3747485c93a6a212b12d6cfde058f;p=thirdparty%2Flibvirt.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 --- diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index c83aa8a6e8..2f7b2e559a 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -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++;