mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00: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;
|
||||
|
||||
if (VIR_ALLOC(addrs) < 0)
|
||||
goto cleanup;
|
||||
goto error;
|
||||
|
||||
if (!(addrs->defined = virHashCreate(10, qemuDomainCCWAddressSetFreeEntry)))
|
||||
goto cleanup;
|
||||
goto error;
|
||||
|
||||
/* must use cssid = 0xfe (254) for virtio-ccw devices */
|
||||
addrs->next.cssid = 254;
|
||||
@ -1273,9 +1273,9 @@ qemuDomainCCWAddressSetCreate(void)
|
||||
addrs->next.assigned = 0;
|
||||
return addrs;
|
||||
|
||||
cleanup:
|
||||
error:
|
||||
qemuDomainCCWAddressSetFree(addrs);
|
||||
return addrs;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user