提交 74cf8202 编写于 作者: M Michael Chapman 提交者: Ján Tomko

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: NMichael Chapman <mike@very.puzzling.org>
上级 7236a473
...@@ -1828,6 +1828,10 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj, ...@@ -1828,6 +1828,10 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
pool->volumes.objs[pool->volumes.count++] = newvol; pool->volumes.objs[pool->volumes.count++] = newvol;
volobj = virGetStorageVol(obj->conn, pool->def->name, newvol->name, volobj = virGetStorageVol(obj->conn, pool->def->name, newvol->name,
newvol->key, NULL, NULL); newvol->key, NULL, NULL);
if (!volobj) {
pool->volumes.count--;
goto cleanup;
}
/* Drop the pool lock during volume allocation */ /* Drop the pool lock during volume allocation */
pool->asyncjobs++; pool->asyncjobs++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册