From nobody Sun Feb 8 15:30:52 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=1601894299; cv=none; d=zohomail.com; s=zohoarc; b=gA4fUi+e/SdlXeT6SYP5cLrGiYBPyjHipt/PoZ8hloaCMzGDkKggcVCe3UDU5JPomtdiuEIjCGfp7LSsJU9FvgfJSs4tN7dne2ShuwKNztTuLrQfkCJ3hFgJEUr7Ps1wk3fcxXxjx88siDAufbi8qgtFZK/GbNhtSCkAQ47wcgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601894299; 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=gU1Eryo6GXxkvwM8QJ5nElbk1mFLjWSJuUfGN07o5X4=; b=EStgCwA+EZGSCbUwH11J24FRLIe75QH59nccg00U3GICU1BZjVacyT5W7Xz1pnj2UH1GdKWqg/AAb2skOIN3gc0QT3I5rSns1WwyW3zN+mYlvDHuwCeQDsasHSBwrcez47VNHlWohIF4LrVmW18uviRJqZVWr4C3Hl2ybyM+rQI= 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 1601894299207225.60672880906475; Mon, 5 Oct 2020 03:38:19 -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-221-8oC6AnlJMl-iGeM6pOD_Tg-1; Mon, 05 Oct 2020 06:38:15 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8BF85800475; Mon, 5 Oct 2020 10:38:09 +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 41F447E731; Mon, 5 Oct 2020 10:38:09 +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 101BE44A6B; Mon, 5 Oct 2020 10:38:09 +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 095AaskY018934 for ; Mon, 5 Oct 2020 06:36:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 25A875C22B; Mon, 5 Oct 2020 10:36:54 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id A144E5C1BD for ; Mon, 5 Oct 2020 10:36:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601894297; 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=gU1Eryo6GXxkvwM8QJ5nElbk1mFLjWSJuUfGN07o5X4=; b=YkzT0l3c1+JOo2vL8E0Tt86BH9M6DJy7AysgkVCJnFXagQ6UGrojgGE7Vz9BRORMKwKdE0 ZOr58o6593n9ztJtCMnwFFburYlEPMXL5TnvQTFPca58vh1wbqd8Y6zD/5/ZB6meaSeLGJ PzsCd5gLbyZ+yjzMW0knM6L8a8a/3kI= X-MC-Unique: 8oC6AnlJMl-iGeM6pOD_Tg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 7/9] qemu: command: use g_new0 Date: Mon, 5 Oct 2020 12:36:37 +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.13 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_command.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e9ba81d82f..476cf6972e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7428,8 +7428,7 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg, hmat =3D true; } =20 - if (VIR_ALLOC_N(nodeBackends, ncells) < 0) - goto cleanup; + nodeBackends =3D g_new0(virBuffer, ncells); =20 /* using of -numa memdev=3D cannot be combined with -numa mem=3D, thus= we * need to check which approach to use */ @@ -8119,9 +8118,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, if (!tapfdSize) tapfdSize =3D 1; =20 - if (VIR_ALLOC_N(tapfd, tapfdSize) < 0 || - VIR_ALLOC_N(tapfdName, tapfdSize) < 0) - goto cleanup; + tapfd =3D g_new0(int, tapfdSize); + tapfdName =3D g_new0(char *, tapfdSize); =20 memset(tapfd, -1, tapfdSize * sizeof(tapfd[0])); =20 @@ -8135,9 +8133,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, if (!tapfdSize) tapfdSize =3D 1; =20 - if (VIR_ALLOC_N(tapfd, tapfdSize) < 0 || - VIR_ALLOC_N(tapfdName, tapfdSize) < 0) - goto cleanup; + tapfd =3D g_new0(int, tapfdSize); + tapfdName =3D g_new0(char *, tapfdSize); =20 memset(tapfd, -1, tapfdSize * sizeof(tapfd[0])); =20 @@ -8151,9 +8148,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, if (!tapfdSize) tapfdSize =3D 1; =20 - if (VIR_ALLOC_N(tapfd, tapfdSize) < 0 || - VIR_ALLOC_N(tapfdName, tapfdSize) < 0) - goto cleanup; + tapfd =3D g_new0(int, tapfdSize); + tapfdName =3D g_new0(char *, tapfdSize); =20 memset(tapfd, -1, tapfdSize * sizeof(tapfd[0])); =20 @@ -8268,9 +8264,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, if (!vhostfdSize) vhostfdSize =3D 1; =20 - if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0 || - VIR_ALLOC_N(vhostfdName, vhostfdSize)) - goto cleanup; + vhostfd =3D g_new0(int, vhostfdSize); + vhostfdName =3D g_new0(char *, vhostfdSize); =20 memset(vhostfd, -1, vhostfdSize * sizeof(vhostfd[0])); =20 @@ -10465,8 +10460,7 @@ qemuBuildStorageSourceAttachPrepareDrive(virDomainD= iskDefPtr disk, { g_autoptr(qemuBlockStorageSourceAttachData) data =3D NULL; =20 - if (VIR_ALLOC(data) < 0) - return NULL; + data =3D g_new0(qemuBlockStorageSourceAttachData, 1); =20 if (!(data->driveCmd =3D qemuBuildDriveStr(disk, qemuCaps)) || !(data->driveAlias =3D qemuAliasDiskDriveFromDisk(disk))) @@ -10543,8 +10537,7 @@ qemuBuildStorageSourceChainAttachPrepareDrive(virDo= mainDiskDefPtr disk, g_autoptr(qemuBlockStorageSourceAttachData) elem =3D NULL; g_autoptr(qemuBlockStorageSourceChainData) data =3D NULL; =20 - if (VIR_ALLOC(data) < 0) - return NULL; + data =3D g_new0(qemuBlockStorageSourceChainData, 1); =20 if (!(elem =3D qemuBuildStorageSourceAttachPrepareDrive(disk, qemuCaps= ))) return NULL; @@ -10595,8 +10588,7 @@ qemuBuildStorageSourceChainAttachPrepareBlockdev(vi= rStorageSourcePtr top, g_autoptr(qemuBlockStorageSourceChainData) data =3D NULL; virStorageSourcePtr n; =20 - if (VIR_ALLOC(data) < 0) - return NULL; + data =3D g_new0(qemuBlockStorageSourceChainData, 1); =20 for (n =3D top; virStorageSourceIsBacking(n); n =3D n->backingStore) { if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n, @@ -10625,8 +10617,7 @@ qemuBuildStorageSourceChainAttachPrepareBlockdevTop= (virStorageSourcePtr top, { g_autoptr(qemuBlockStorageSourceChainData) data =3D NULL; =20 - if (VIR_ALLOC(data) < 0) - return NULL; + data =3D g_new0(qemuBlockStorageSourceChainData, 1); =20 if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, top, bac= kingStore, qemuCaps) < 0) --=20 2.26.2