mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Fix crash on OOM in qemuDomainCCWAddressSetCreate()
If OOM occurs in qemuDomainCCWAddressSetCreate, it jumps to a cleanup block and frees the partially initialized object. It then mistakenly returns the address of the just free'd pointer instead of NULL. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
f27490b705
commit
ba19783d9b
@ -1261,10 +1261,10 @@ qemuDomainCCWAddressSetCreate(void)
|
|||||||
qemuDomainCCWAddressSetPtr addrs = NULL;
|
qemuDomainCCWAddressSetPtr addrs = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(addrs) < 0)
|
if (VIR_ALLOC(addrs) < 0)
|
||||||
goto cleanup;
|
goto error;
|
||||||
|
|
||||||
if (!(addrs->defined = virHashCreate(10, qemuDomainCCWAddressSetFreeEntry)))
|
if (!(addrs->defined = virHashCreate(10, qemuDomainCCWAddressSetFreeEntry)))
|
||||||
goto cleanup;
|
goto error;
|
||||||
|
|
||||||
/* must use cssid = 0xfe (254) for virtio-ccw devices */
|
/* must use cssid = 0xfe (254) for virtio-ccw devices */
|
||||||
addrs->next.cssid = 254;
|
addrs->next.cssid = 254;
|
||||||
@ -1273,9 +1273,9 @@ qemuDomainCCWAddressSetCreate(void)
|
|||||||
addrs->next.assigned = 0;
|
addrs->next.assigned = 0;
|
||||||
return addrs;
|
return addrs;
|
||||||
|
|
||||||
cleanup:
|
error:
|
||||||
qemuDomainCCWAddressSetFree(addrs);
|
qemuDomainCCWAddressSetFree(addrs);
|
||||||
return addrs;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user