From 74cf8202d2e3747485c93a6a212b12d6cfde058f Mon Sep 17 00:00:00 2001 From: Michael Chapman Date: Wed, 12 Feb 2014 22:05:51 +1100 Subject: [PATCH] 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 --- src/storage/storage_driver.c | 4 ++++ 1 file changed, 4 insertions(+) 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++; -- 2.47.2