提交 0a562de1 编写于 作者: P Paolo Bonzini 提交者: Eric Blake

qemu: fix use-after-free when parsing NBD disk

disk->src is still used for disks->hosts->name, do not free it.
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 5b17c7a9
......@@ -8832,12 +8832,11 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
if (VIR_ALLOC(disk->hosts) < 0)
goto no_memory;
disk->nhosts = 1;
disk->hosts->name = host;
disk->hosts->name = disk->src;
disk->src = NULL;
disk->hosts->port = strdup(port);
if (!disk->hosts->port)
goto no_memory;
VIR_FREE(disk->src);
disk->src = NULL;
break;
case VIR_DOMAIN_DISK_PROTOCOL_RBD:
/* old-style CEPH_ARGS env variable is parsed later */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册