From nobody Sun Feb 8 12:20:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601894349; cv=none; d=zohomail.com; s=zohoarc; b=FP3VuXdCiRaVLPf0YBZ/CsBwGspJuuSLBN8imxnLIi/9dbOx+0G8F0gUyaHMn8PZXrFR6Nx+TyKEvc2oU7TfiiSwSnWPo7BF4Pk3uNQJ4xw84epZCbYQR620WX5XzXyiIYmwz8a/LbV42BG2/0TX7T6hdiVcSFyzkM8pj9ICs24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601894349; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8yw7falJf3u/dJhzrCZ/3mRZMCZz/AjlQ/zAfIkPB4Y=; b=Jww9qQKNyN8Cv7oX6cPbvmPl+WcpdY60DJICyIbs1BNErKv0hzBmbPTRhQAyaOFD6MeielgAUDuqOqJGj6Pv6p23vQ/ChMQ4v7YTAsoNsk18yPphAldJTXYHmou2q4b0jxTnUz4yTeZ0UrDjZMDVEehBVRD2DeOrv9JNs2DexQE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1601894349858923.416688862039; Mon, 5 Oct 2020 03:39:09 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-o1mAYNEdOnyomNzlUaKqlQ-1; Mon, 05 Oct 2020 06:38:13 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D7036801AF0; Mon, 5 Oct 2020 10:38:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B57465D9E4; Mon, 5 Oct 2020 10:38:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 84BBE44A5F; Mon, 5 Oct 2020 10:38:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 095AarrY018925 for ; Mon, 5 Oct 2020 06:36:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 546335C22B; Mon, 5 Oct 2020 10:36:53 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id D03815C1BD for ; Mon, 5 Oct 2020 10:36:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601894348; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8yw7falJf3u/dJhzrCZ/3mRZMCZz/AjlQ/zAfIkPB4Y=; b=PGBETu54AMksiIVYPG3xxEe9FNCSTcnuSyocTuOGV/LBPdnj9GQaoi1MHLDwRhBGZxOL+P NO5RwUn1KSP7vV5+0NBTL2nbo6ycnEXYmCL+lhxFcf5AN/sL7fUe8IrWuY7u3OyBLgheb7 FZCV3qz2CIerOmfDBHZGCCaGP8nOjuY= X-MC-Unique: o1mAYNEdOnyomNzlUaKqlQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 6/9] qemu: process: use g_new0 Date: Mon, 5 Oct 2020 12:36:36 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_process.c | 56 +++++++++++++---------------------------- 1 file changed, 18 insertions(+), 38 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 93cbb37986..94b44f1c5c 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -302,8 +302,7 @@ qemuProcessHandleMonitorEOF(qemuMonitorPtr mon, goto cleanup; } =20 - if (VIR_ALLOC(processEvent) < 0) - goto cleanup; + processEvent =3D g_new0(struct qemuProcessEvent, 1); =20 processEvent->eventType =3D QEMU_PROCESS_EVENT_MONITOR_EOF; processEvent->vm =3D virObjectRef(vm); @@ -832,8 +831,7 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon G_GNUC_UNU= SED, =20 if (vm->def->watchdog->action =3D=3D VIR_DOMAIN_WATCHDOG_ACTION_DUMP) { struct qemuProcessEvent *processEvent; - if (VIR_ALLOC(processEvent) < 0) - ; + processEvent =3D g_new0(qemuProcessEvent, 1); =20 processEvent->eventType =3D QEMU_PROCESS_EVENT_WATCHDOG; processEvent->action =3D VIR_DOMAIN_WATCHDOG_ACTION_DUMP; @@ -965,8 +963,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon G_GNUC_UNU= SED, virDomainObjBroadcast(vm); } else { /* there is no waiting SYNC API, dispatch the update to a thread */ - if (VIR_ALLOC(processEvent) < 0) - goto cleanup; + processEvent =3D g_new0(qemuProcessEvent, 1); =20 processEvent->eventType =3D QEMU_PROCESS_EVENT_BLOCK_JOB; data =3D g_strdup(diskAlias); @@ -1030,8 +1027,7 @@ qemuProcessHandleJobStatusChange(qemuMonitorPtr mon G= _GNUC_UNUSED, virDomainObjBroadcast(vm); } else { VIR_DEBUG("job '%s' handled by event thread", jobname); - if (VIR_ALLOC(processEvent) < 0) - goto cleanup; + processEvent =3D g_new0(qemuProcessEvent, 1); =20 processEvent->eventType =3D QEMU_PROCESS_EVENT_JOB_STATUS_CHANGE; processEvent->vm =3D virObjectRef(vm); @@ -1074,20 +1070,17 @@ qemuProcessHandleGraphics(qemuMonitorPtr mon G_GNUC= _UNUSED, virDomainEventGraphicsSubjectPtr subject =3D NULL; size_t i; =20 - if (VIR_ALLOC(localAddr) < 0) - goto error; + localAddr =3D g_new0(virDomainEventGraphicsAddress, 1); localAddr->family =3D localFamily; localAddr->service =3D g_strdup(localService); localAddr->node =3D g_strdup(localNode); =20 - if (VIR_ALLOC(remoteAddr) < 0) - goto error; + remoteAddr =3D g_new0(virDomainEventGraphicsAddress, 1); remoteAddr->family =3D remoteFamily; remoteAddr->service =3D g_strdup(remoteService); remoteAddr->node =3D g_strdup(remoteNode); =20 - if (VIR_ALLOC(subject) < 0) - goto error; + subject =3D g_new0(virDomainEventGraphicsSubject, 1); if (x509dname) { if (VIR_REALLOC_N(subject->identities, subject->nidentity+1) < 0) goto error; @@ -1329,8 +1322,7 @@ qemuProcessHandleGuestPanic(qemuMonitorPtr mon G_GNUC= _UNUSED, struct qemuProcessEvent *processEvent; =20 virObjectLock(vm); - if (VIR_ALLOC(processEvent) < 0) - goto cleanup; + processEvent =3D g_new0(struct qemuProcessEvent, 1); =20 processEvent->eventType =3D QEMU_PROCESS_EVENT_GUESTPANIC; processEvent->action =3D vm->def->onCrash; @@ -1345,7 +1337,6 @@ qemuProcessHandleGuestPanic(qemuMonitorPtr mon G_GNUC= _UNUSED, qemuProcessEventFree(processEvent); } =20 - cleanup: virObjectUnlock(vm); =20 return 0; @@ -1371,8 +1362,7 @@ qemuProcessHandleDeviceDeleted(qemuMonitorPtr mon G_G= NUC_UNUSED, QEMU_DOMAIN_UNPLUGGING_DEVICE_STATUS= _OK)) goto cleanup; =20 - if (VIR_ALLOC(processEvent) < 0) - goto error; + processEvent =3D g_new0(struct qemuProcessEvent, 1); =20 processEvent->eventType =3D QEMU_PROCESS_EVENT_DEVICE_DELETED; data =3D g_strdup(devAlias); @@ -1552,8 +1542,7 @@ qemuProcessHandleNicRxFilterChanged(qemuMonitorPtr mo= n G_GNUC_UNUSED, VIR_DEBUG("Device %s RX Filter changed in domain %p %s", devAlias, vm, vm->def->name); =20 - if (VIR_ALLOC(processEvent) < 0) - goto error; + processEvent =3D g_new0(struct qemuProcessEvent, 1); =20 processEvent->eventType =3D QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED; data =3D g_strdup(devAlias); @@ -1590,8 +1579,7 @@ qemuProcessHandleSerialChanged(qemuMonitorPtr mon G_G= NUC_UNUSED, VIR_DEBUG("Serial port %s state changed to '%d' in domain %p %s", devAlias, connected, vm, vm->def->name); =20 - if (VIR_ALLOC(processEvent) < 0) - goto error; + processEvent =3D g_new0(struct qemuProcessEvent, 1); =20 processEvent->eventType =3D QEMU_PROCESS_EVENT_SERIAL_CHANGED; data =3D g_strdup(devAlias); @@ -1800,8 +1788,7 @@ qemuProcessHandlePRManagerStatusChanged(qemuMonitorPt= r mon G_GNUC_UNUSED, priv =3D vm->privateData; priv->prDaemonRunning =3D false; =20 - if (VIR_ALLOC(processEvent) < 0) - goto cleanup; + processEvent =3D g_new0(struct qemuProcessEvent, 1); =20 processEvent->eventType =3D QEMU_PROCESS_EVENT_PR_DISCONNECT; processEvent->vm =3D virObjectRef(vm); @@ -1838,8 +1825,7 @@ qemuProcessHandleRdmaGidStatusChanged(qemuMonitorPtr = mon G_GNUC_UNUSED, VIR_DEBUG("netdev=3D%s,gid_status=3D%d,subnet_prefix=3D0x%llx,interfac= e_id=3D0x%llx", netdev, gid_status, subnet_prefix, interface_id); =20 - if (VIR_ALLOC(info) < 0) - goto cleanup; + info =3D g_new0(qemuMonitorRdmaGidStatus, 1); =20 info->netdev =3D g_strdup(netdev); =20 @@ -1847,8 +1833,7 @@ qemuProcessHandleRdmaGidStatusChanged(qemuMonitorPtr = mon G_GNUC_UNUSED, info->subnet_prefix =3D subnet_prefix; info->interface_id =3D interface_id; =20 - if (VIR_ALLOC(processEvent) < 0) - goto cleanup; + processEvent =3D g_new0(struct qemuProcessEvent, 1); =20 processEvent->eventType =3D QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED; processEvent->vm =3D virObjectRef(vm); @@ -1877,8 +1862,7 @@ qemuProcessHandleGuestCrashloaded(qemuMonitorPtr mon = G_GNUC_UNUSED, struct qemuProcessEvent *processEvent; =20 virObjectLock(vm); - if (VIR_ALLOC(processEvent) < 0) - goto cleanup; + processEvent =3D g_new0(struct qemuProcessEvent, 1); =20 processEvent->eventType =3D QEMU_PROCESS_EVENT_GUEST_CRASHLOADED; processEvent->vm =3D virObjectRef(vm); @@ -1888,7 +1872,6 @@ qemuProcessHandleGuestCrashloaded(qemuMonitorPtr mon = G_GNUC_UNUSED, qemuProcessEventFree(processEvent); } =20 - cleanup: virObjectUnlock(vm); =20 return 0; @@ -4589,8 +4572,7 @@ qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps, if (qemuMigrationDstCheckProtocol(qemuCaps, migrateFrom) < 0) return NULL; =20 - if (VIR_ALLOC(inc) < 0) - return NULL; + inc =3D g_new0(qemuProcessIncomingDef, 1); =20 inc->address =3D g_strdup(listenAddress); =20 @@ -8431,8 +8413,7 @@ qemuProcessReconnectHelper(virDomainObjPtr obj, if (!obj->pid) return 0; =20 - if (VIR_ALLOC(data) < 0) - return -1; + data =3D g_new0(struct qemuProcessReconnectData, 1); =20 memcpy(data, src, sizeof(*data)); data->obj =3D obj; @@ -8588,8 +8569,7 @@ qemuProcessQMPNew(const char *binary, VIR_DEBUG("exec=3D%s, libDir=3D%s, runUid=3D%u, runGid=3D%u, forceTCG= =3D%d", binary, libDir, runUid, runGid, forceTCG); =20 - if (VIR_ALLOC(proc) < 0) - return NULL; + proc =3D g_new0(qemuProcessQMP, 1); =20 proc->binary =3D g_strdup(binary); proc->libDir =3D g_strdup(libDir); --=20 2.26.2