qemu: prevent SIGSEGV in qemuProcessHandleDumpCompleted

If VIR_ASYNC_JOB_NONE flag is present, job.current is equal
to NULL, which leads to SIGSEGV. Thus, this check should be
moved up.

Fixes: v8.0.0-427-gf304de0df6
Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Nikolai Barybin 2023-06-27 11:43:58 +03:00 committed by Jiri Denemark
parent 83686f1eea
commit 2d6659e778

View File

@ -1601,11 +1601,11 @@ qemuProcessHandleDumpCompleted(qemuMonitor *mon G_GNUC_UNUSED,
vm, vm->def->name, stats, NULLSTR(error));
jobPriv = vm->job->privateData;
privJobCurrent = vm->job->current->privateData;
if (vm->job->asyncJob == VIR_ASYNC_JOB_NONE) {
VIR_DEBUG("got DUMP_COMPLETED event without a dump_completed job");
goto cleanup;
}
privJobCurrent = vm->job->current->privateData;
jobPriv->dumpCompleted = true;
privJobCurrent->stats.dump = *stats;
vm->job->error = g_strdup(error);