mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: separate out VIR_ALLOC calls
Move them to separate conditions to reduce churn in following patches. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
15914d0707
commit
868c350752
@ -3719,8 +3719,10 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
||||
|
||||
if (j == def->npanics) {
|
||||
virDomainPanicDefPtr panic;
|
||||
if (VIR_ALLOC(panic) < 0 ||
|
||||
VIR_APPEND_ELEMENT_COPY(def->panics,
|
||||
if (VIR_ALLOC(panic) < 0)
|
||||
return -1;
|
||||
|
||||
if (VIR_APPEND_ELEMENT_COPY(def->panics,
|
||||
def->npanics, panic) < 0) {
|
||||
VIR_FREE(panic);
|
||||
return -1;
|
||||
|
@ -4890,8 +4890,10 @@ qemuMonitorJSONParseBlockJobInfo(virHashTablePtr blockJobs,
|
||||
if (!rawjobname)
|
||||
device = qemuAliasDiskDriveSkipPrefix(device);
|
||||
|
||||
if (VIR_ALLOC(info) < 0 ||
|
||||
virHashAddEntry(blockJobs, device, info) < 0) {
|
||||
if (VIR_ALLOC(info) < 0)
|
||||
return -1;
|
||||
|
||||
if (virHashAddEntry(blockJobs, device, info) < 0) {
|
||||
VIR_FREE(info);
|
||||
return -1;
|
||||
}
|
||||
|
@ -832,17 +832,18 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon G_GNUC_UNUSED,
|
||||
|
||||
if (vm->def->watchdog->action == VIR_DOMAIN_WATCHDOG_ACTION_DUMP) {
|
||||
struct qemuProcessEvent *processEvent;
|
||||
if (VIR_ALLOC(processEvent) == 0) {
|
||||
processEvent->eventType = QEMU_PROCESS_EVENT_WATCHDOG;
|
||||
processEvent->action = VIR_DOMAIN_WATCHDOG_ACTION_DUMP;
|
||||
/* Hold an extra reference because we can't allow 'vm' to be
|
||||
* deleted before handling watchdog event is finished.
|
||||
*/
|
||||
processEvent->vm = virObjectRef(vm);
|
||||
if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) {
|
||||
virObjectUnref(vm);
|
||||
qemuProcessEventFree(processEvent);
|
||||
}
|
||||
if (VIR_ALLOC(processEvent) < 0)
|
||||
;
|
||||
|
||||
processEvent->eventType = QEMU_PROCESS_EVENT_WATCHDOG;
|
||||
processEvent->action = VIR_DOMAIN_WATCHDOG_ACTION_DUMP;
|
||||
/* Hold an extra reference because we can't allow 'vm' to be
|
||||
* deleted before handling watchdog event is finished.
|
||||
*/
|
||||
processEvent->vm = virObjectRef(vm);
|
||||
if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) {
|
||||
virObjectUnref(vm);
|
||||
qemuProcessEventFree(processEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user