[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemu_blockjob: Avoid dereferencing NULL on OOM



Signed-off-by: Jiri Denemark <jdenemar redhat com>
---
 src/qemu/qemu_blockjob.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 4ada4cd27..985fae1e9 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -123,7 +123,8 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
                 if ((persistDisk = virDomainDiskByName(vm->newDef,
                                                        disk->dst, false))) {
                     copy = virStorageSourceCopy(disk->mirror, false);
-                    if (virStorageSourceInitChainElement(copy,
+                    if (!copy ||
+                        virStorageSourceInitChainElement(copy,
                                                          persistDisk->src,
                                                          true) < 0) {
                         VIR_WARN("Unable to update persistent definition "
-- 
2.11.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]