]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
storage: handle NULL return from virGetStorageVol
authorMichael Chapman <mike@very.puzzling.org>
Wed, 12 Feb 2014 11:05:51 +0000 (22:05 +1100)
committerJán Tomko <jtomko@redhat.com>
Wed, 12 Feb 2014 14:18:43 +0000 (15:18 +0100)
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>
src/storage/storage_driver.c

index c83aa8a6e8aec210746f51e6d6e7a24d82556510..2f7b2e559a04d589a504fe07f6fee1e57760c76b 100644 (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++;