From nobody Tue Oct 28 17:50:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1759854882; cv=none; d=zohomail.com; s=zohoarc; b=QpctKntG8fLnPlyLy2KQuDrCsUq19KX1VxV1JOCp8ATSD927EhsLBiwqpZK5JLd08O7tMSW8ryUVKMvBQBmiMAxW5Naet2DTNp/6DlGvBicUPHma7mi/vpEyGazN44GirPBNAoFnsVXv39xWPTEe8Rgt8/chXK8WlGSAKhOoLFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1759854882; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=1qydHZCxSk/R4APxMLCXvKxWnJ1p6qDfnWbRRfU4gTQ=; b=BF6Twi4ToGZ9My35mBZe85E5pGbBzHn3SmG5sSVqZjfXAqC22S+7eqm70KySRVDeShL+FGeJCyPoZ11NqQzt4/v2mI7X1WrfbL1e1WfBQz/SREsCEJ43sy7w8NikV5c/P5WtNnbYHlgIoi/gxJQKkvaP+Mg5kHfRI7/mmWFWwbw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1759854882676706.3472291485122; Tue, 7 Oct 2025 09:34:42 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9AD12417CF; Tue, 7 Oct 2025 12:34:33 -0400 (EDT) Received: from [172.19.199.17] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id E9CD8443D9; Tue, 7 Oct 2025 12:31:40 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D4827441D2; Tue, 7 Oct 2025 12:31:24 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 4EF2F44278 for ; Tue, 7 Oct 2025 12:31:16 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-609-8Ikro1ncPZedUdDajx0Dwg-1; Tue, 07 Oct 2025 12:31:03 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0DFA7195605F for ; Tue, 7 Oct 2025 16:31:03 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.9]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BA23D1955F44; Tue, 7 Oct 2025 16:31:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759854676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1qydHZCxSk/R4APxMLCXvKxWnJ1p6qDfnWbRRfU4gTQ=; b=IsKQ/cus5GAUosw6ZVEq9Bf+HGkx+uJIeKxTLVSIwmY0RlMzCwR6/5MnJ3A/qM8BFFk/Na uGFROMfZm7JuVAjo8978lTAio+BqY7bihYeO7JvJ7g5+ylb2i5ae4WzgwKihVxzNQLmQE+ qhSrl5deZBP7h7hvf4kiwUg+vqzmSSI= X-MC-Unique: 8Ikro1ncPZedUdDajx0Dwg-1 X-Mimecast-MFC-AGG-ID: 8Ikro1ncPZedUdDajx0Dwg_1759854663 To: devel@lists.libvirt.org Subject: [PATCH 1/2] Replace all use of 'g_new' with 'g_new0' Date: Tue, 7 Oct 2025 18:30:56 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: cw45yeG_2kSiNmrN7qO6HfkdMQ1z-MpwfHS7sJXTIdw_1759854663 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IXUOEEMR5XQGW7A5TRK2XDDJQCGFE7HZ X-Message-ID-Hash: IXUOEEMR5XQGW7A5TRK2XDDJQCGFE7HZ X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Peter Krempa X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1759854885320154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Always use the version which clears the allocated memory. Signed-off-by: Peter Krempa --- src/network/network_pf.c | 2 +- src/qemu/qemu_nbdkit.c | 2 +- src/qemu/qemu_process.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/network_pf.c b/src/network/network_pf.c index ce4461c999..f655a7a68b 100644 --- a/src/network/network_pf.c +++ b/src/network/network_pf.c @@ -131,7 +131,7 @@ findDefaultRouteInterface(void) if (i =3D=3D RTAX_IFP && sa->sa_family =3D=3D AF_LINK)= { sdl =3D (struct sockaddr_dl *)(void *)sa; ifname_len =3D (sdl->sdl_nlen >=3D IFNAMSIZ) ? IFN= AMSIZ - 1 : sdl->sdl_nlen; - ifname =3D g_new(char, ifname_len + 1); + ifname =3D g_new0(char, ifname_len + 1); virStrcpy(ifname, sdl->sdl_data, ifname_len + 1); return ifname; } diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c index 65c98de017..c1bc6bc363 100644 --- a/src/qemu/qemu_nbdkit.c +++ b/src/qemu/qemu_nbdkit.c @@ -644,7 +644,7 @@ static qemuNbdkitProcessEventData* qemuNbdkitProcessEventDataNew(qemuNbdkitProcess *proc, virDomainObj *vm) { - qemuNbdkitProcessEventData *d =3D g_new(qemuNbdkitProcessEventData, 1); + qemuNbdkitProcessEventData *d =3D g_new0(qemuNbdkitProcessEventData, 1= ); d->proc =3D proc; d->vm =3D virObjectRef(vm); return d; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ead5bf3e48..57b14f640e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8704,7 +8704,7 @@ typedef struct { static qemuProcessInShutdownEventData* qemuProcessInShutdownEventDataNew(virDomainObj *vm, int pidfd) { - qemuProcessInShutdownEventData *d =3D g_new(qemuProcessInShutdownEvent= Data, 1); + qemuProcessInShutdownEventData *d =3D g_new0(qemuProcessInShutdownEven= tData, 1); d->vm =3D virObjectRef(vm); d->pidfd =3D pidfd; return d; --=20 2.51.0