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>
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;
addrs->next.assigned = 0;
return addrs;
-cleanup:
+error:
qemuDomainCCWAddressSetFree(addrs);
- return addrs;
+ return NULL;
}
/*