From nobody Sun Feb 8 21:29:14 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=1601894244; cv=none; d=zohomail.com; s=zohoarc; b=C9szL/6BfzZZ/3Vauq3tOt68EvYKA0PcxTLlDPbFoJmMgyE6POhcj8v+XrOsNUNEKXxkT2ux/SQtLl2riy3kgaWqIdPOrYvZvB3RCPscJzRYudPZSCQUm+HK/+E4byU9z2Thip10HvzGaJF6x6D/YSN7obSZDFajEeG3LJ6eXNw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601894244; 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=jXdmoz3A03T5p7RYMDhltXDU6+mYhpZ+o4CZ6lq/lpE=; b=aRJcHboFaoiZXZryVh/QDU72Zlbwwsqoc4STTT+SFP5Pc93o/Y5yb6Ry1dSUpXR3G0Xfyp7QF5JEiLphyxMa5Eamw47Uq+dwEwpqYsIo5uTrR28U8bW7Ut57VjL52OFWA+DkIALEesIVgHYDdjVYKgVgUTu+1l0zw7Dfn7/XGFg= 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 1601894244808265.2972122621388; Mon, 5 Oct 2020 03:37:24 -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-53-kiMaOS96PcGk-Y_3gFBnBw-1; Mon, 05 Oct 2020 06:37:20 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9840281CBDF; Mon, 5 Oct 2020 10:37:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FBBD1C92B; Mon, 5 Oct 2020 10:37:14 +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 3955E181A6DF; Mon, 5 Oct 2020 10:37:14 +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 095AaiN1018871 for ; Mon, 5 Oct 2020 06:36:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id D87145C1BD; Mon, 5 Oct 2020 10:36:44 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 614205C225 for ; Mon, 5 Oct 2020 10:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601894243; 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=jXdmoz3A03T5p7RYMDhltXDU6+mYhpZ+o4CZ6lq/lpE=; b=B/IyEaUPLfqzbJSfXpvhdi8m+IX2Vjtg5UlViME9AFhcU33J30bczMiLUXptGtJhvbkCkp ZCHDa1Jkf29pTySHIcFnqgTh4yzJBWjh4RGAEcmnAL+PvdyRcSShlSturW26kO8NXbfJJ2 ym7502lMu532ymNccgIuAugBV0j8ItA= X-MC-Unique: kiMaOS96PcGk-Y_3gFBnBw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/9] qemu: separate out VIR_ALLOC calls Date: Mon, 5 Oct 2020 12:36:31 +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.84 on 10.5.11.23 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) Move them to separate conditions to reduce churn in following patches. Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 6 ++++-- src/qemu/qemu_monitor_json.c | 6 ++++-- src/qemu/qemu_process.c | 23 ++++++++++++----------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0331fd55e0..491fb0ed3d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3719,8 +3719,10 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def, =20 if (j =3D=3D 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; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index bc242c798b..c399100dbe 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4890,8 +4890,10 @@ qemuMonitorJSONParseBlockJobInfo(virHashTablePtr blo= ckJobs, if (!rawjobname) device =3D qemuAliasDiskDriveSkipPrefix(device); =20 - 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; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 9122069cc9..93cbb37986 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -832,17 +832,18 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon G_GNUC_U= NUSED, =20 if (vm->def->watchdog->action =3D=3D VIR_DOMAIN_WATCHDOG_ACTION_DUMP) { struct qemuProcessEvent *processEvent; - if (VIR_ALLOC(processEvent) =3D=3D 0) { - processEvent->eventType =3D QEMU_PROCESS_EVENT_WATCHDOG; - processEvent->action =3D 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 =3D virObjectRef(vm); - if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) = < 0) { - virObjectUnref(vm); - qemuProcessEventFree(processEvent); - } + if (VIR_ALLOC(processEvent) < 0) + ; + + processEvent->eventType =3D QEMU_PROCESS_EVENT_WATCHDOG; + processEvent->action =3D 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 =3D virObjectRef(vm); + if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0)= { + virObjectUnref(vm); + qemuProcessEventFree(processEvent); } } =20 --=20 2.26.2