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: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
5b17c7a954
commit
0a562de1ff
@ -8832,12 +8832,11 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
|
|||||||
if (VIR_ALLOC(disk->hosts) < 0)
|
if (VIR_ALLOC(disk->hosts) < 0)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
disk->nhosts = 1;
|
disk->nhosts = 1;
|
||||||
disk->hosts->name = host;
|
disk->hosts->name = disk->src;
|
||||||
|
disk->src = NULL;
|
||||||
disk->hosts->port = strdup(port);
|
disk->hosts->port = strdup(port);
|
||||||
if (!disk->hosts->port)
|
if (!disk->hosts->port)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
VIR_FREE(disk->src);
|
|
||||||
disk->src = NULL;
|
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_DISK_PROTOCOL_RBD:
|
case VIR_DOMAIN_DISK_PROTOCOL_RBD:
|
||||||
/* old-style CEPH_ARGS env variable is parsed later */
|
/* old-style CEPH_ARGS env variable is parsed later */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user