From nobody Fri Dec 12 12:53:53 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=1764073197; cv=none; d=zohomail.com; s=zohoarc; b=FDn7cwh4RzlkvKKf5v6gVM3EnUJXj1AvdhsPzo1cwts00wJoy12KoDzqwRSJJeN2OmlhyZP5qNa93yWAsUAyDF+fK4iU42z9XQ941qMfJjkP/IXnkmzkWjf8+EBKjQwM0E+0JJb61LZQ+D49pGt9g/KtcM+zTJ449r4UUNsiS7o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073197; 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=ObUsKNbmXMW99nasA5aLqf+lCxQmT+Maxt3EqW1Ovyk=; b=LSSlK54RmK7+yTUmy5xmYrdio3NeSCRJpvqnjA2Y4TSS9uKALgD51sVqqA+cVGexAs4XZWFqgXispmeJEOno8cohJGst1GSk6nq0QI+g7e8S6jIl2glQ1Sm42Q/Gqtg/9+AbwlkKqNsRoJXfogF6fCL5YORWKzV/SUg0oPx+cO4= 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 1764073197752335.819611446134; Tue, 25 Nov 2025 04:19:57 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 0FC9B44CA4; Tue, 25 Nov 2025 07:19:57 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 5233844810; Tue, 25 Nov 2025 07:18:27 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 3F45343F05; Tue, 25 Nov 2025 07:18:15 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 6058D44026 for ; Tue, 25 Nov 2025 07:18:14 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-510-zVrTdr_mN-C7jZ6VA62Oyg-1; Tue, 25 Nov 2025 07:18:12 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D93981800650 for ; Tue, 25 Nov 2025 12:18:11 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 06E2F1800840; Tue, 25 Nov 2025 12:18:10 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073094; 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=ObUsKNbmXMW99nasA5aLqf+lCxQmT+Maxt3EqW1Ovyk=; b=At8yie4LsQeiQvsJyXjTPqktDbN/ks4gw3QW1xexnGhJveKJO5yTbsdRqeXo+HwfJB4Amq +3+qCMXHV70DY5xHxrV5OTOMUB7C+ReecWSBErrDUQb4vgvzcDNT0Vn3UHQYPZZXa+6JPf KQxxleOKRYYLlx9gQo0gJSAcgTfDOSw= X-MC-Unique: zVrTdr_mN-C7jZ6VA62Oyg-1 X-Mimecast-MFC-AGG-ID: zVrTdr_mN-C7jZ6VA62Oyg_1764073092 To: devel@lists.libvirt.org Subject: [PATCH v2 01/22] virQEMUCapsKVMSupportsNesting: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:31 +0100 Message-ID: <20251125121753.444490-2-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 0iQjQFQ1Xdcwb7QtNj1_rmoL6nt-rfft_LcwIJO4Y7Q_1764073092 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4TPPJJLR6EYDKU4Y7FG2RO4IBCJGXSF4 X-Message-ID-Hash: 4TPPJJLR6EYDKU4Y7FG2RO4IBCJGXSF4 X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073199690019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Changed value var scope to enable auto memory management capailities, moved variables to closer scope. Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_capabilities.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 92b863a826..ef4704ecc6 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5536,12 +5536,12 @@ virQEMUCapsKVMSupportsNesting(void) { static char const * const kmod[] =3D {"kvm_intel", "kvm_amd", "kvm_hv", "kvm"}; - g_autofree char *value =3D NULL; - int rc; size_t i; =20 for (i =3D 0; i < G_N_ELEMENTS(kmod); i++) { - VIR_FREE(value); + g_autofree char *value =3D NULL; + int rc; + rc =3D virFileReadValueString(&value, "/sys/module/%s/parameters/n= ested", kmod[i]); if (rc =3D=3D -2) --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073262; cv=none; d=zohomail.com; s=zohoarc; b=OhLz1IBB7NZYkUg389Kr5wSCVTUNPKbFRH5L3mKaP9RqPGxVBUf/LzCtEfwITCExEc2OpO48IJ88xBl7uOVT3N82VARc+yj9kM81DvuQuy5+4DJBEkLlkcF6Zj0UeBTN4XAcDJO8fJRdS5O5kom4shsP/XFz0176hAhyTtt6cQw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073262; 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=y5qsjAkzaIxdjQm/M58nRFYWApmTo+JZnrK9ZjarOgc=; b=h9dqwTIihNp4c05+55McHm5+X94waganZx721anPjisYpcWDNb4a0kWUooLf0XuiUxxcnnTFF5RAL2MYgNuBcUpaZu9mbOCTX+OWSMo+uM2jaA5EW42R3m+MnwmYanuYMnrAlHrh8iGZLzMoeSsQt5SIiJLl33Pl5PBzTnzVEJ0= 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 1764073262533955.4085172857946; Tue, 25 Nov 2025 04:21:02 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 7997244D5C; Tue, 25 Nov 2025 07:20:59 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 1A58F44874; Tue, 25 Nov 2025 07:18:31 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 73B5643FF1; Tue, 25 Nov 2025 07:18:16 -0500 (EST) 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 D079F43F05 for ; Tue, 25 Nov 2025 07:18:15 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-569-_DMDBtQWOFmXS_yqSIqlpA-1; Tue, 25 Nov 2025 07:18:14 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 49AA91800342 for ; Tue, 25 Nov 2025 12:18:13 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 43B5A180049F; Tue, 25 Nov 2025 12:18:12 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073095; 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=y5qsjAkzaIxdjQm/M58nRFYWApmTo+JZnrK9ZjarOgc=; b=UW/DiUgtB0EDGEvt0i/mfPT1QePmET8ltJZWTG7BgpyFan3PZGoBt9n8ZC8Iku0url9Or1 JpdJsQRXSEhiv02tQCKf0U48T9aIJHUMfkfTXCYgriSdfg47rKpfZm/m1k8jA9GiVIgkCH 2sANlhO0JuFicDKRp2lyzV2mR3f9HG4= X-MC-Unique: _DMDBtQWOFmXS_yqSIqlpA-1 X-Mimecast-MFC-AGG-ID: _DMDBtQWOFmXS_yqSIqlpA_1764073093 To: devel@lists.libvirt.org Subject: [PATCH v2 02/22] qemuDomainSetVcpusAgent: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:32 +0100 Message-ID: <20251125121753.444490-3-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: sPiXUQyg6_PNzgFu0I0J6tKj5P0xeXg69pkmlVcjHZk_1764073093 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: DGVTONTWBKCFPZVFLGZU7QARM7JGHQKI X-Message-ID-Hash: DGVTONTWBKCFPZVFLGZU7QARM7JGHQKI X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073264307019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Use auto memory management, no more cleanup stage required Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_driver.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f2e024dae3..c480bb59e1 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4146,19 +4146,19 @@ static int qemuDomainSetVcpusAgent(virDomainObj *vm, unsigned int nvcpus) { - qemuAgentCPUInfo *cpuinfo =3D NULL; + g_autofree qemuAgentCPUInfo *cpuinfo =3D NULL; qemuAgent *agent; int ncpuinfo; int ret =3D -1; =20 if (!qemuDomainAgentAvailable(vm, true)) - goto cleanup; + return -1; =20 if (nvcpus > virDomainDefGetVcpus(vm->def)) { virReportError(VIR_ERR_INVALID_ARG, _("requested vcpu count is greater than the count o= f enabled vcpus in the domain: %1$d > %2$d"), nvcpus, virDomainDefGetVcpus(vm->def)); - goto cleanup; + return -1; } =20 agent =3D qemuDomainObjEnterAgent(vm); @@ -4167,21 +4167,18 @@ qemuDomainSetVcpusAgent(virDomainObj *vm, agent =3D NULL; =20 if (ncpuinfo < 0) - goto cleanup; + return -1; =20 if (qemuAgentUpdateCPUInfo(nvcpus, cpuinfo, ncpuinfo) < 0) - goto cleanup; + return -1; =20 if (!qemuDomainAgentAvailable(vm, true)) - goto cleanup; + return -1; =20 agent =3D qemuDomainObjEnterAgent(vm); ret =3D qemuAgentSetVCPUs(agent, cpuinfo, ncpuinfo); qemuDomainObjExitAgent(vm, agent); =20 - cleanup: - VIR_FREE(cpuinfo); - return ret; } =20 --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073318; cv=none; d=zohomail.com; s=zohoarc; b=Y1C3lnwQqkSsXHjoz9LlaPeIwDxgKhJg9Sx41+GapntA4W0hU6L9HUm4xWSt6m0bBeh42WNH1U3u0xrsgWQjAIHuyuuiMp1E06sm8+VIHgLhGp5h19LNxwcbxLfxy4+cE5ffGjfKvi8qVBAEz+u/FpS9H9a6LLUCSxksMD15HRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073318; 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=SmUF8aKJW5HRKdZ7JSc/Lf9+NAwk6GvQBhRLVvRfN6U=; b=EjujA5DN2MOwLn9Xoo+N+r56o9BH6FI+njj+zINfw663iMhOWRgs4rDE76gDc6f4Zmqv06m1/QZ77VfnUndncBJDMLm0wg1lCjLkmrwfS9UFrU5BUeZZLbtVKCmA8r4QEtAg3URM0w5VNXp013FQfo6PR+dMQekMPINZjjbYySQ= 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 1764073318724945.6149387876586; Tue, 25 Nov 2025 04:21:58 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 04D2444B04; Tue, 25 Nov 2025 07:21:56 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id A546944B50; Tue, 25 Nov 2025 07:18:34 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id CC56E4404F; Tue, 25 Nov 2025 07:18:17 -0500 (EST) 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 9734943F05 for ; Tue, 25 Nov 2025 07:18:16 -0500 (EST) 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-591-p2zzBBouOKeFHYDUQ0oVjw-1; Tue, 25 Nov 2025 07:18:15 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 4C36E19560B5 for ; Tue, 25 Nov 2025 12:18:14 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 773FD180049F; Tue, 25 Nov 2025 12:18:13 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073096; 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=SmUF8aKJW5HRKdZ7JSc/Lf9+NAwk6GvQBhRLVvRfN6U=; b=VeIo8fcaC5DN2pI1J872GixYbBPZ4dCpgh4M2kfGUgS4oTCOzF282ROJfyHUyeDdjKDv1F UgTyDB2eGglAFHRgwF7kALG9LqQh6WMA601cZlZbeQ8j4f5VJqqYZtKFMTvu1TJn+vvqF9 a/MK5GIxiKWqEN+Cugu8tGF2f80EidA= X-MC-Unique: p2zzBBouOKeFHYDUQ0oVjw-1 X-Mimecast-MFC-AGG-ID: p2zzBBouOKeFHYDUQ0oVjw_1764073094 To: devel@lists.libvirt.org Subject: [PATCH v2 03/22] qemuDomainGetHostnameLease: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:33 +0100 Message-ID: <20251125121753.444490-4-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 8Yo_LkdwHB48CZ_PBZsCmxrYzwyZrSl59EugsS3V3BE_1764073094 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PK4JMDJ47NJT6CKSMQEH2RXR2RI6SHQU X-Message-ID-Hash: PK4JMDJ47NJT6CKSMQEH2RXR2RI6SHQU X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073320768019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Moved variables to closer scope to enable suto memory management Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_driver.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c480bb59e1..eb4e9c1c39 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16356,10 +16356,7 @@ static int qemuDomainGetHostnameLease(virDomainObj *vm, char **hostname) { - char macaddr[VIR_MAC_STRING_BUFLEN]; g_autoptr(virConnect) conn =3D NULL; - virNetworkDHCPLeasePtr *leases =3D NULL; - int n_leases; size_t i, j; int ret =3D -1; =20 @@ -16375,6 +16372,9 @@ qemuDomainGetHostnameLease(virDomainObj *vm, for (i =3D 0; i < vm->def->nnets; i++) { g_autoptr(virNetwork) network =3D NULL; virDomainNetDef *net =3D vm->def->nets[i]; + char macaddr[VIR_MAC_STRING_BUFLEN]; + g_autofree virNetworkDHCPLeasePtr *leases =3D NULL; + int n_leases; =20 if (net->type !=3D VIR_DOMAIN_NET_TYPE_NETWORK) continue; @@ -16390,15 +16390,11 @@ qemuDomainGetHostnameLease(virDomainObj *vm, goto endjob; =20 for (j =3D 0; j < n_leases; j++) { - virNetworkDHCPLeasePtr lease =3D leases[j]; + g_autoptr(virNetworkDHCPLease) lease =3D leases[j]; if (lease->hostname && !*hostname) *hostname =3D g_strdup(lease->hostname); - - virNetworkDHCPLeaseFree(lease); } =20 - VIR_FREE(leases); - if (*hostname) goto endjob; } --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073403; cv=none; d=zohomail.com; s=zohoarc; b=bW6OBesoh8GabAbmDhklFFxMusBVCfPq20VVdi3i/PdLA9lv5EOwcIQL0PlWaluJXie0QOQj4ciDkhxdIEjaJt1a53h1Hb4j3NLtJ45MXpZHWw9b5mPlAKQw4sJx+Yo00F2uYWUpbk7Y4zmCofMXJQttl6WjfqVDhu6I+OzrjTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073403; 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=q7c1yYNuEsG/X9x4AIm7TcPJmB4q+AeLvtLag5QxPxg=; b=PnIjLPrCc1yE6JbE4s8ek/6ZceB9tLEMSzUVVsMnIskg7o1qBwHk/m5bTkSrzoTcaWAKy50zNCWpLJxRvuk2UOnlsqMJThh2CVKfyKPpl2YTVrbppcw3PZO3Vjshbl+WtNQtLzaZAx9nf1z9BGRUvCwMnft2AHSew1t24Bwv7BM= 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 1764073401937920.313070369275; Tue, 25 Nov 2025 04:23:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 0154844B45; Tue, 25 Nov 2025 07:23:20 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 7063D448D7; Tue, 25 Nov 2025 07:18:39 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id D95C8449A0; Tue, 25 Nov 2025 07:18:23 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 D40A843F05 for ; Tue, 25 Nov 2025 07:18:17 -0500 (EST) 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-382-ODH0FJkAO2KgPrMoL0qw5w-1; Tue, 25 Nov 2025 07:18:16 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 960771956059 for ; Tue, 25 Nov 2025 12:18:15 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B9535180047F; Tue, 25 Nov 2025 12:18:14 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073097; 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=q7c1yYNuEsG/X9x4AIm7TcPJmB4q+AeLvtLag5QxPxg=; b=CPqvt9mWKYPdjr2dwoIM7hVo+PBtufNI7g92D4+cQRxtPHa8hQ/qmCFrmTGAZ+HWGESSid YAYKHOkQ+Gn8oydrlrwFtQY2PoVVJNwm+2G2Hg3cxEsvU9ucc7QnYki76QjP3L9Sbdtp5h KIl7SrLvsZ0V2JYb8lkukqBKglhbcRM= X-MC-Unique: ODH0FJkAO2KgPrMoL0qw5w-1 X-Mimecast-MFC-AGG-ID: ODH0FJkAO2KgPrMoL0qw5w_1764073095 To: devel@lists.libvirt.org Subject: [PATCH v2 04/22] qemuProcessRefreshChannelVirtioState: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:34 +0100 Message-ID: <20251125121753.444490-5-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: hrgE0iPlqmRLaog0XUsbKMrfYJm34cJ3SJPohlDtlBI_1764073095 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4735BNUBAJTA5NR2XUYU2HEJGVA6GOZR X-Message-ID-Hash: 4735BNUBAJTA5NR2XUYU2HEJGVA6GOZR X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073403461019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Moved variables to closer scope to enbale asuto memory management Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_process.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 0e50cd1ccc..36f62b718d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2251,9 +2251,6 @@ qemuProcessRefreshChannelVirtioState(virQEMUDriver *d= river, { size_t i; int agentReason =3D VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CH= ANNEL; - qemuMonitorChardevInfo *entry; - virObjectEvent *event =3D NULL; - g_autofree char *id =3D NULL; =20 if (booted) agentReason =3D VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DO= MAIN_STARTED; @@ -2261,8 +2258,10 @@ qemuProcessRefreshChannelVirtioState(virQEMUDriver *= driver, for (i =3D 0; i < vm->def->nchannels; i++) { virDomainChrDef *chr =3D vm->def->channels[i]; if (chr->targetType =3D=3D VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRT= IO) { + qemuMonitorChardevInfo *entry =3D NULL; + virObjectEvent *event =3D NULL; + g_autofree char *id =3D NULL; =20 - VIR_FREE(id); id =3D g_strdup_printf("char%s", chr->info.alias); =20 /* port state not reported */ --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073477; cv=none; d=zohomail.com; s=zohoarc; b=JKQZOlcgJMOCK1NktdO+MlyYjxKFV9191WdLatLrI7JD495QLw9dA3qnFe1gzGWJap8g8Doq8uTLvjqB/oB6n2dJEyggm9BjVc4LV32PNnDPiy+jSb5OlIP7BTUHDQkTR/+yRBCSADRJsVqvpoE0NmFemmH2P+ALe9FxdJw3UFk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073477; 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=SBMUgTsygKS1o1yrEgeZc7SdUhSexvRFdgmN0//B0T8=; b=bxo2HsOg5Ecbwe4XVE+Gj5uRkQrI6GEpXgIv79B/igby9AB+UdN7kklCbLRiN77uzbEpfuOXQqoQd/pPf1v+qzHzNMbH+3AL45DUx3GYztT5leIF6/xSGXsAvMctnR4qoxBybcI0k4I9ttEPqR00Ed4oPkCjtPeek/RQIm69U4A= 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 1764073477330930.8017864567632; Tue, 25 Nov 2025 04:24:37 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id A6B95419AA; Tue, 25 Nov 2025 07:24:35 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 7502A44BD2; Tue, 25 Nov 2025 07:18:42 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id AA323447A8; Tue, 25 Nov 2025 07:18:30 -0500 (EST) 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 DD73E447A8 for ; Tue, 25 Nov 2025 07:18:18 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-641-IBYRq5TRMfyhpqqWnDx2mw-1; Tue, 25 Nov 2025 07:18:17 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C929118001FE for ; Tue, 25 Nov 2025 12:18:16 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F4171180047F; Tue, 25 Nov 2025 12:18:15 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073098; 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=SBMUgTsygKS1o1yrEgeZc7SdUhSexvRFdgmN0//B0T8=; b=h3QltWLYjC5UfN8KCUXbpHlWeIpHo4lctgvezFfdJcpbVOdMiypMCTkzVoiIcfPrO246AZ qydzVoYbUyTseUh0pFQY4Box9kbu4xYIxMZXzquSyycSxbF84JeHFlhT1KbtqT1frOd+/f EgVTb2KBXFbvXdDvVbmEDBAOz6aZtJs= X-MC-Unique: IBYRq5TRMfyhpqqWnDx2mw-1 X-Mimecast-MFC-AGG-ID: IBYRq5TRMfyhpqqWnDx2mw_1764073096 To: devel@lists.libvirt.org Subject: [PATCH v2 05/22] qemuMigrationSrcPerformPeer2Peer2: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:35 +0100 Message-ID: <20251125121753.444490-6-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Q-jmh6enhwDfdFJ-NDhPouf1XLclZsUDGmNLfqwW-0I_1764073096 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: RDWE6CAZ4E4TK2SXW2OZ6DAU45LO3BEO X-Message-ID-Hash: RDWE6CAZ4E4TK2SXW2OZ6DAU45LO3BEO X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073478114019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Defined glib cleanup function for virStream object type and enabled the automatic memory management Signed-off-by: Kirill Shchetiniuk --- src/datatypes.h | 1 + src/qemu/qemu_migration.c | 14 +++++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/datatypes.h b/src/datatypes.h index c5a7ece786..8dd4d87572 100644 --- a/src/datatypes.h +++ b/src/datatypes.h @@ -746,6 +746,7 @@ struct _virStream { virFreeCallback ff; }; =20 +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virStream, virObjectUnref); =20 /** * _virDomainCheckpoint diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 9059f9aa3a..881133caed 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -5564,13 +5564,13 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriver *dr= iver, qemuMigrationParams *migParams) { virDomainPtr ddomain =3D NULL; - char *uri_out =3D NULL; - char *cookie =3D NULL; - char *dom_xml =3D NULL; + g_autofree char *uri_out =3D NULL; + g_autofree char *cookie =3D NULL; + g_autofree char *dom_xml =3D NULL; int cookielen =3D 0, ret; virErrorPtr orig_err =3D NULL; bool cancelled; - virStreamPtr st =3D NULL; + g_autoptr(virStream) st =3D NULL; unsigned long destflags; =20 VIR_DEBUG("driver=3D%p, sconn=3D%p, dconn=3D%p, vm=3D%p, dconnuri=3D%s= , " @@ -5616,7 +5616,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriver *driv= er, if (qemuDomainObjExitRemote(vm, true) < 0) goto cleanup; } - VIR_FREE(dom_xml); + if (ret =3D=3D -1) goto cleanup; =20 @@ -5680,11 +5680,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriver *dri= ver, ret =3D -1; } =20 - virObjectUnref(st); - virErrorRestore(&orig_err); - VIR_FREE(uri_out); - VIR_FREE(cookie); =20 return ret; } --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073544; cv=none; d=zohomail.com; s=zohoarc; b=d4yD6eUG9JMH7C3+e8we4Jb7pjyioLj0+Fsxbz0buwNaq1GBCXJd9GbYHUr8VEK2N5SppanXT3VB7R0N2cMhUqM7fRS7jgDbt41IJh4lv9der3ZdIEy/AlAmkuVF/YUqB5AFkylvibkd6qqCatxywfQNuArCoUduDh1QSo0+sEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073544; 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=9nHvf8wQkkXxeOqf/5li3QJOMhQAWorqFT5oHMXIiB8=; b=T199MFa5gxt13lWUYdwkF0K34IdAZE9FcC80QKBrFehb2BBpQ2/sx5y7Clpcpf9g8F77VTiVfv+3ST6Q87K9zSA+SoFEFBICSXT0jTzSoFb5+8b1VUXJIcYwg7ofeOMiiPo8nVxRKRaft4wVrAs98Klg+EKSQaGvPwx30hKjIpA= 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 176407354441829.548969548240052; Tue, 25 Nov 2025 04:25:44 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id C127444AAC; Tue, 25 Nov 2025 07:25:39 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id AA7F944C1D; Tue, 25 Nov 2025 07:18:46 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 3A0C944908; Tue, 25 Nov 2025 07:18:36 -0500 (EST) 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 583D7448B2 for ; Tue, 25 Nov 2025 07:18:20 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695--M6gVbd0Oia3SS0IwT8Kng-1; Tue, 25 Nov 2025 07:18:18 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0A62A180048E for ; Tue, 25 Nov 2025 12:18:18 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3422D1800361; Tue, 25 Nov 2025 12:18:17 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073100; 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=9nHvf8wQkkXxeOqf/5li3QJOMhQAWorqFT5oHMXIiB8=; b=WzZYnl6zdUClh0aNY0uUd25H3tyrh3zZsPsp9nEHGAH8B9oRZXZSuwh8i5jTY31ju/EoAT cXWtPituxuRuOjcbzDIXmHzGYugRswXZzAmJ6AY84ixwe4D+Bu87Z7yEwI7Vuzlef1Qxm3 UQ1m3egM0Hivh9OF9+0XC/D5bAiRi9k= X-MC-Unique: -M6gVbd0Oia3SS0IwT8Kng-1 X-Mimecast-MFC-AGG-ID: -M6gVbd0Oia3SS0IwT8Kng_1764073098 To: devel@lists.libvirt.org Subject: [PATCH v2 06/22] qemuDomainMasterKeyReadFile: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:36 +0100 Message-ID: <20251125121753.444490-7-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Y5fjZoByBarD38yI9jVnT-Uu0fEf9nRZKABzzEzPUkU_1764073098 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: SAECFL7HILEANBHKFWKRZC7OTHQYKVTO X-Message-ID-Hash: SAECFL7HILEANBHKFWKRZC7OTHQYKVTO X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073546419019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Use the automemory management for the master key, use the virSecureErase for safe clear of the key in case of error. Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_domain.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ac56fc7cb4..c788eb3e2a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -566,7 +566,7 @@ qemuDomainMasterKeyReadFile(qemuDomainObjPrivate *priv) { g_autofree char *path =3D NULL; int fd =3D -1; - uint8_t *masterKey =3D NULL; + g_autofree uint8_t *masterKey =3D NULL; ssize_t masterKeyLen =3D 0; =20 if (!(path =3D qemuDomainGetMasterKeyFilePath(priv->libDir))) @@ -601,7 +601,7 @@ qemuDomainMasterKeyReadFile(qemuDomainObjPrivate *priv) =20 masterKey =3D g_renew(uint8_t, masterKey, masterKeyLen); =20 - priv->masterKey =3D masterKey; + priv->masterKey =3D g_steal_pointer(&masterKey); priv->masterKeyLen =3D masterKeyLen; =20 VIR_FORCE_CLOSE(fd); @@ -609,9 +609,7 @@ qemuDomainMasterKeyReadFile(qemuDomainObjPrivate *priv) return 0; =20 error: - if (masterKeyLen > 0) - memset(masterKey, 0, masterKeyLen); - VIR_FREE(masterKey); + virSecureErase(masterKey, masterKeyLen); =20 VIR_FORCE_CLOSE(fd); =20 --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073616; cv=none; d=zohomail.com; s=zohoarc; b=R7/jRea4ObtJp5wiot/ajFL8PKpyEfdz3bScBApanAgL/SWYGziaLSLERifAJyE2kQNyIxL8Pm324qoabzXRO4IKgxRarq6uRhUhcd2l5z6Rarcaz6nqTwgdnwe2ceZW9vIwVTK1GWmH2NiUjhuA0xwdSRM9WwTaMykEvqYDk0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073616; 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=kL341DDYJLYIFQCTMRay5QAjhJn5vav+t8CrjW0OHug=; b=SE4XG/5tY4XNxwqGufhbotBB3Olhk1Uln9UVpLoDnZIVsUVObmHt/r85xOfthqb5G8fqF6xte8WZzKUF65MYutc4n3oF6wLVOcSM+z0OkE9DGVaTX/Cx6CihqXk2gL/eImIxvKs31KRXCfxMBGIHhDci2ms0cB7EqfX9Jo1fBhU= 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 1764073616080312.6208355457446; Tue, 25 Nov 2025 04:26:56 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 6100041A3A; Tue, 25 Nov 2025 07:26:50 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id D6C5444C3D; Tue, 25 Nov 2025 07:18:56 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 30AA644030; Tue, 25 Nov 2025 07:18:49 -0500 (EST) 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 8B97A4494E for ; Tue, 25 Nov 2025 07:18:21 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-17-dz51yB-4NMGlX6dOJIrTEQ-1; Tue, 25 Nov 2025 07:18:20 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 43D8F180048E for ; Tue, 25 Nov 2025 12:18:19 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6F543180047F; Tue, 25 Nov 2025 12:18:18 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073101; 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=kL341DDYJLYIFQCTMRay5QAjhJn5vav+t8CrjW0OHug=; b=RCgLN1ym2C2cYCk6Hwf3Ol6sT3JpUo6JFAMdVlrIDaikOqekFDbxf3U5wqanGFjMMo+roN m3lZ/6C7jkfjTIrIPfLSMatPBu827vckMP+6UzeOvgwppA4HbBv52oRNoZkQe2lBLjRHrB Os2fEbSQSQhf9LsOJWWxKUH5P9GwaSg= X-MC-Unique: dz51yB-4NMGlX6dOJIrTEQ-1 X-Mimecast-MFC-AGG-ID: dz51yB-4NMGlX6dOJIrTEQ_1764073099 To: devel@lists.libvirt.org Subject: [PATCH v2 07/22] qemuDomainObjPrivateXMLParse: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:37 +0100 Message-ID: <20251125121753.444490-8-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: jzw2fA9qx-BMHBlzp3QDL95FbspuYm1Hr0hKwdIiVRg_1764073099 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: C3V7N4O3QLUG5FXC7ICGHDNSX6DR2WAS X-Message-ID-Hash: C3V7N4O3QLUG5FXC7ICGHDNSX6DR2WAS X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073617078019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_domain.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c788eb3e2a..5f1ee4e0e3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3320,7 +3320,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, { qemuDomainObjPrivate *priv =3D vm->privateData; virQEMUDriver *driver =3D config->priv; - char *monitorpath; + g_autofree char *monitorpath =3D NULL; g_autofree char *tmp =3D NULL; int n; size_t i; @@ -3347,13 +3347,12 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctx= t, =20 switch (priv->monConfig->type) { case VIR_DOMAIN_CHR_TYPE_PTY: - priv->monConfig->data.file.path =3D monitorpath; + priv->monConfig->data.file.path =3D g_steal_pointer(&monitorpath); break; case VIR_DOMAIN_CHR_TYPE_UNIX: - priv->monConfig->data.nix.path =3D monitorpath; + priv->monConfig->data.nix.path =3D g_steal_pointer(&monitorpath); break; default: - VIR_FREE(monitorpath); virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported monitor type '%1$s'"), virDomainChrTypeToString(priv->monConfig->type)); --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073673; cv=none; d=zohomail.com; s=zohoarc; b=KiyeCuJs2J043l0aHxeOeyVS5PKJeY9AGdUMIVbrv6W5WPLtQ0vLrvp8RKF1lkhEtWN1uvTNiEs6RtG/gobRbHMqYvdvLIuEmqENGjZCqC6qJWyB80wzJeKmqksPOdtCbw5YgexpR1AvHWuRAu5wBfJGaLQZOoL8Ws5nWZ1yr7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073673; 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=2tBO1KUnZFran4FoP0dsNlo3lPiCQ+fyBmuj1YOECtA=; b=LckQ1yoOTor3RnBi/FOSIEo81UKGtoI/MWRUrcmnIP7QrxuhrTCh5XAJnJewYDikAc+C8rxNeloy1U/SLuBW4fTKKeYRkZCY6zjclo8vuJVnqoCJWiFNyYlwbXudXdLKigelc3u0cmgw4IdaJknSzNJ6HqE6V0zy1GK9G5TDKpQ= 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 1764073673791202.08976044479232; Tue, 25 Nov 2025 04:27:53 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 4412B44BF7; Tue, 25 Nov 2025 07:27:46 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id DE602445D0; Tue, 25 Nov 2025 07:19:20 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id A8843447F0; Tue, 25 Nov 2025 07:19:14 -0500 (EST) 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 76391449B8 for ; Tue, 25 Nov 2025 07:18:23 -0500 (EST) Received: from mx-prod-mc-01.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-163-yIW8Mp4yPxyHHJeEXiGImQ-1; Tue, 25 Nov 2025 07:18:21 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8268A1954B24 for ; Tue, 25 Nov 2025 12:18:20 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A34D7180047F; Tue, 25 Nov 2025 12:18:19 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073103; 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=2tBO1KUnZFran4FoP0dsNlo3lPiCQ+fyBmuj1YOECtA=; b=FPajvR/Ew4ZFo9YbrsMxIrA58Tqm4idLeqW1XTIyuT2AZx9xjl5JROcv9jU8nJLa4eoHDD VeaVZ+6733lLbrcyNK67+DHO76z1bjND8geo5YM5D3I92zvLM12EHLGWqmJFwAqhhzTfk2 0CpFDFVZmNHOAowO3hf6Bp+/QrpEbaQ= X-MC-Unique: yIW8Mp4yPxyHHJeEXiGImQ-1 X-Mimecast-MFC-AGG-ID: yIW8Mp4yPxyHHJeEXiGImQ_1764073100 To: devel@lists.libvirt.org Subject: [PATCH v2 08/22] qemuDomainGetGuestVcpus: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:38 +0100 Message-ID: <20251125121753.444490-9-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: HfU7AGn9_656ZT1WPBHi1LauwjAmRXKrq0rC-hZv6Ug_1764073100 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FU4FHEJMNPIUG5D2LZ7OPPOK2M37MZND X-Message-ID-Hash: FU4FHEJMNPIUG5D2LZ7OPPOK2M37MZND X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073675661019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index eb4e9c1c39..16331d8f54 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18853,7 +18853,7 @@ qemuDomainGetGuestVcpus(virDomainPtr dom, { virDomainObj *vm =3D NULL; qemuAgent *agent; - qemuAgentCPUInfo *info =3D NULL; + g_autofree qemuAgentCPUInfo *info =3D NULL; int ninfo =3D 0; int ret =3D -1; =20 @@ -18887,7 +18887,6 @@ qemuDomainGetGuestVcpus(virDomainPtr dom, virDomainObjEndAgentJob(vm); =20 cleanup: - VIR_FREE(info); virDomainObjEndAPI(&vm); return ret; } --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073724; cv=none; d=zohomail.com; s=zohoarc; b=k0hmku/9NTPWj0Ge5nj+oBJoDv1gKuldaA1eIKcLQE0rR9d0b8CvPaxSsdmLDZiahtk5uekU6IxuCTaSIkC8hp9I07cWCuypSvqTqbsKKdYFFwW+IYfSADEUWau3ZybFM96yOJnxUciTbQTLhINWNT2B8Ia0vARjFzO0dFGcw1M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073724; 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=QLZKWx62hqeaaNePkf9cD9vnUNOrscF8CKF6UFkMbO0=; b=J5mDhSC3v+EnvO1Ol5I8+VpFEAEBISn/PNeXJOxXDsG8chD5gi5yC8Fe5+W3Rr87jgoS5JHZF5C4LZnhAAMlhO9FnZIXxxQm02c08ftqImCxr/1yaoArj+OZNc7tUsy/5gwEvhmy4V5HCwv1id+bJqCOH3X1clVf6Vt+Eb0E4Hk= 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 1764073724239186.76577294558217; Tue, 25 Nov 2025 04:28:44 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id A93C644C2A; Tue, 25 Nov 2025 07:28:43 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id E997044C9F; Tue, 25 Nov 2025 07:19:27 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 89ADB44C5F; Tue, 25 Nov 2025 07:19:20 -0500 (EST) 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 2510B449A4 for ; Tue, 25 Nov 2025 07:18:24 -0500 (EST) Received: from mx-prod-mc-01.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-191-7AHBl-UcN56TxyckL-KgGA-1; Tue, 25 Nov 2025 07:18:22 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D759819560B0 for ; Tue, 25 Nov 2025 12:18:21 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E00CF180047F; Tue, 25 Nov 2025 12:18:20 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073103; 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=QLZKWx62hqeaaNePkf9cD9vnUNOrscF8CKF6UFkMbO0=; b=H7YcQJIyMlOWkDozUH0yRiFeqTFwbUCXvvyf+IVoszeQixwbAWcttwHzsAArUNDU1EbTlf R6SlekjyyZB3ZhqRv9rR5VK5qLabZAjYUNtavrWU4bqgzTDCrqP77ilG/3gmZs7bsMj8bu Y65uuQTvf+KJRqWG2mAGYCaFBJ8DLno= X-MC-Unique: 7AHBl-UcN56TxyckL-KgGA-1 X-Mimecast-MFC-AGG-ID: 7AHBl-UcN56TxyckL-KgGA_1764073102 To: devel@lists.libvirt.org Subject: [PATCH v2 09/22] qemuDomainSetGuestVcpus: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:39 +0100 Message-ID: <20251125121753.444490-10-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: jpUUcKFDQaEhIm-VK9YL6kAH-et-hWyFqbmjURAHzsU_1764073102 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HBRWEBQ35IBDLQ5XT75MJF66PR7RJ3C3 X-Message-ID-Hash: HBRWEBQ35IBDLQ5XT75MJF66PR7RJ3C3 X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073725990019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 16331d8f54..66ed7cdf2f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18900,7 +18900,7 @@ qemuDomainSetGuestVcpus(virDomainPtr dom, { virDomainObj *vm =3D NULL; g_autoptr(virBitmap) map =3D NULL; - qemuAgentCPUInfo *info =3D NULL; + g_autofree qemuAgentCPUInfo *info =3D NULL; qemuAgent *agent; int ninfo =3D 0; size_t i; @@ -18970,7 +18970,6 @@ qemuDomainSetGuestVcpus(virDomainPtr dom, virDomainObjEndAgentJob(vm); =20 cleanup: - VIR_FREE(info); virDomainObjEndAPI(&vm); return ret; } --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073780; cv=none; d=zohomail.com; s=zohoarc; b=eVVAX18fX1Ro1PwsVriyu6qUCv+1tB6ojDrWyyehmnpGhqUtTuKbXg23PxAQmSiyAZIopLW1IIHsF5c4BQSaIVds5Ip3tUbnrCBzsK+Jg5uVkuGM4KmEKrqEKJbt0fOD769bWAHoy3amrLqJ4yTPv5BQ7sxA58v2PcFBnE8+cxg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073780; 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=iIJ7gguZEud/HZIXsIMF6wHtttWQbCZ5Sb8O93DAj90=; b=ZOy2MXXt5nWGrRXJyu2dhxwqJ55ziheAZc45fgFsql9BxOVdPTl4Bh4mg9+Q3bSS0DLli7ibTCZgMNCD1L7EYxx1l30y89JBSoQ0P2mAE0ekrwmRKWW0qKXvsqdnuKZvdC/qKpN69Qc4DW3jJD/CFgq5yOWovzw1Mz5fOv25p84= 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 17640737801931020.4661434178253; Tue, 25 Nov 2025 04:29:40 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 9476244C20; Tue, 25 Nov 2025 07:29:39 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 2865044BCF; Tue, 25 Nov 2025 07:19:42 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id D836644BFE; Tue, 25 Nov 2025 07:19:33 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 70D14449F4 for ; Tue, 25 Nov 2025 07:18:25 -0500 (EST) Received: from mx-prod-mc-05.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-58-vjgUPG4zMwC7K3d31pYTvw-1; Tue, 25 Nov 2025 07:18:23 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1FDD619560AA for ; Tue, 25 Nov 2025 12:18:23 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 41735180049F; Tue, 25 Nov 2025 12:18:22 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073105; 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=iIJ7gguZEud/HZIXsIMF6wHtttWQbCZ5Sb8O93DAj90=; b=M7tnhQl9699yHmaIngcmlSNXAAL+141A9SUbyb5STKj1GI1mqyn+bmTlOKC8vMO5O8kKhV DKYMsiaH4sgNYNQqTxxWnOZtaWd4Ac1dCPiZHOH58+lAMpNPst6J2FrWlPavUssxx0u9JY IrSJrmlzQazJYSaw9qFIu2rSn4HM+D4= X-MC-Unique: vjgUPG4zMwC7K3d31pYTvw-1 X-Mimecast-MFC-AGG-ID: vjgUPG4zMwC7K3d31pYTvw_1764073103 To: devel@lists.libvirt.org Subject: [PATCH v2 10/22] qemuMonitorInitBalloonObjectPath: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:40 +0100 Message-ID: <20251125121753.444490-11-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: b6-VUmh4tb3anmRu79iiv86T1PJuMBqtsWfTyn8MKuM_1764073103 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 35DO3SYKTMZVXVHW5XEOADG6YJIYH4Q3 X-Message-ID-Hash: 35DO3SYKTMZVXVHW5XEOADG6YJIYH4Q3 X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073780629019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_monitor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 504500c864..3d833eb818 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -890,7 +890,7 @@ qemuMonitorInitBalloonObjectPath(qemuMonitor *mon, virDomainMemballoonDef *balloon) { ssize_t i, nprops =3D 0; - char *path =3D NULL; + g_autofree char *path =3D NULL; const char *name; qemuMonitorJSONListPath **bprops =3D NULL; =20 @@ -970,7 +970,6 @@ qemuMonitorInitBalloonObjectPath(qemuMonitor *mon, for (i =3D 0; i < nprops; i++) qemuMonitorJSONListPathFree(bprops[i]); VIR_FREE(bprops); - VIR_FREE(path); return; } =20 --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073826; cv=none; d=zohomail.com; s=zohoarc; b=DJb0E2zKUjao+fpcRQNyJ2UmeMqyXYGNtMvUGypjcaQxr1fqEnyU/SCmTWMr2RIflrSZEwP3hOSb9mg1RHWxF1gYKa3UPggJKHJ9PP5QV0yVMwz8lWSniqpSwZcvFf4kLv5VT91lqjI00/BKkr6g+9DldgWgIsB17rwux/eDPow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073826; 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=CU1FI/roVL5njEkHJNAPq5VxxWCCZWDwX/2t1iRhGrE=; b=DS1smXb2zbNDSkU0y0p0u5VXXfv3ky8UhuyYGyXwkNsUtaHj7dVLgwMzbTUJVobHVgsz0yKvHysZllQqVfxZWQUZUPXMq1FHpfAeFUgdwVtk76TaWt0+o5Ev6BDTSK6CpIHSVvy5qfjJaLozRB9uUB1GpzKzR0Tnwrp9/P6EhJA= 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 1764073825096965.4736933323956; Tue, 25 Nov 2025 04:30:25 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 925DE44B59; Tue, 25 Nov 2025 07:30:21 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 68FA644D10; Tue, 25 Nov 2025 07:19:51 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 81DEB44B1C; Tue, 25 Nov 2025 07:19:44 -0500 (EST) 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 B2F5644486 for ; Tue, 25 Nov 2025 07:18:26 -0500 (EST) Received: from mx-prod-mc-01.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-307-bY5sjSRdM1en-wLAxA8X_g-1; Tue, 25 Nov 2025 07:18:25 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5C8131954231 for ; Tue, 25 Nov 2025 12:18:24 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7E1ED180049F; Tue, 25 Nov 2025 12:18:23 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073106; 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=CU1FI/roVL5njEkHJNAPq5VxxWCCZWDwX/2t1iRhGrE=; b=bp4yBHD+3QegFYC7qYPRaaYALKV/E1zvdCMjoWJUo1X8fvJI2ElyI6qE98IyjbU03PrkQa jeMt4jLmxLCMw5sVpKma7KlmBrb++w4F3aD15JcUiSulb2MG6Ix9QCe3sQNWaCDd48js92 0Onoid8u9csLzDO22uKc7lE+fcXDiUo= X-MC-Unique: bY5sjSRdM1en-wLAxA8X_g-1 X-Mimecast-MFC-AGG-ID: bY5sjSRdM1en-wLAxA8X_g_1764073104 To: devel@lists.libvirt.org Subject: [PATCH v2 11/22] qemuMonitorMigrateToHost: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:41 +0100 Message-ID: <20251125121753.444490-12-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: drZNW3pwJOT3oTXjlMYAy4HNvjF9CpLoTlsm6KY_7XI_1764073104 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: AFYVYVIXF4WNUMDDJ6ACNOWQC2YC4RGT X-Message-ID-Hash: AFYVYVIXF4WNUMDDJ6ACNOWQC2YC4RGT X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073829171019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_monitor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 3d833eb818..d204682472 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2340,7 +2340,7 @@ qemuMonitorMigrateToHost(qemuMonitor *mon, int port) { int ret; - char *uri =3D NULL; + g_autofree char *uri =3D NULL; VIR_DEBUG("hostname=3D%s port=3D%d flags=3D0x%x", hostname, port, flag= s); =20 QEMU_CHECK_MONITOR(mon); @@ -2351,7 +2351,6 @@ qemuMonitorMigrateToHost(qemuMonitor *mon, =20 ret =3D qemuMonitorJSONMigrate(mon, flags, uri); =20 - VIR_FREE(uri); return ret; } =20 --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073875; cv=none; d=zohomail.com; s=zohoarc; b=gZ9jpoZd7ur1xr3MRD7VEij0PGHHS4iHbk75dEemQk9x+lBmIooSZ2AtQrV9pRe3yoXNFVaW5RfYHKXts99/7hX1H8mEhwaBzElMJkKX/7GCRSf+GHVylTKa5deOINDHpYXd3ggM3BQpLem2Q1ufN/l0IkiKLejCdqZOU/mrLKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073875; 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=kOYkV8TW8CdJlULx3mhJE6xStlFIRy3vtoIlnHbPbZE=; b=EJ4XfITe4i4+GK8WArzr/0QkztoiYpD18iFLGvGNedWY4j/9449i6BH6RGeVyA18UPAvDy5YaDUqk14DO1tv5yu2mRv7LrAcDKbofSKqDcFHWrgXypA3L7tDmKmkwbG5Gbp3G1O45QGQ+6OAYAEYUuhPh1+wPxt4EhdkE04ckGA= 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 176407387525950.20871780974062; Tue, 25 Nov 2025 04:31:15 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id D662A44780; Tue, 25 Nov 2025 07:31:08 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 9072C44D38; Tue, 25 Nov 2025 07:20:17 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 3E81F44A62; Tue, 25 Nov 2025 07:20:06 -0500 (EST) 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 1B3B444A38 for ; Tue, 25 Nov 2025 07:18:28 -0500 (EST) Received: from mx-prod-mc-05.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-357-Hy9JEA4kPUiJaDzD_nHJig-1; Tue, 25 Nov 2025 07:18:26 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 98DB8195608A for ; Tue, 25 Nov 2025 12:18:25 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BA10F1800361; Tue, 25 Nov 2025 12:18:24 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073107; 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=kOYkV8TW8CdJlULx3mhJE6xStlFIRy3vtoIlnHbPbZE=; b=I59DUnZHD+iT7eNsP8aMKbNr7+wUG9Oc0+kzWhEG9rB1I929Bp/fACJb9rm0x8ACWOTFm+ D6uqWLzHKk+wlbfoEro3M9BnEnULoPKMiGIpIEwXI64v/coxZnMZRbIwIbuF/69vFqJ7TE cQfojvBafe8euaqofKBTFnNNDMAlkpU= X-MC-Unique: Hy9JEA4kPUiJaDzD_nHJig-1 X-Mimecast-MFC-AGG-ID: Hy9JEA4kPUiJaDzD_nHJig_1764073105 To: devel@lists.libvirt.org Subject: [PATCH v2 12/22] qemuMigrationAnyParseURI: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:42 +0100 Message-ID: <20251125121753.444490-13-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: gAu2IOO5ShHNvlAhr8baVk2ZRwn6hoXNn5GMokr3ctU_1764073105 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IGHNJL3LBFUH6M4JLYVKUSKARKPNS322 X-Message-ID-Hash: IGHNJL3LBFUH6M4JLYVKUSKARKPNS322 X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073877732019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_migration.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 881133caed..d8c5f57d90 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3852,7 +3852,7 @@ qemuMigrationDstPrepareTunnel(virQEMUDriver *driver, static virURI * qemuMigrationAnyParseURI(const char *uri, bool *wellFormed) { - char *tmp =3D NULL; + g_autofree char *tmp =3D NULL; virURI *parsed; =20 /* For compatibility reasons tcp://... URIs are sent as tcp:... @@ -3865,7 +3865,6 @@ qemuMigrationAnyParseURI(const char *uri, bool *wellF= ormed) parsed =3D virURIParse(uri); if (parsed && wellFormed) *wellFormed =3D !tmp; - VIR_FREE(tmp); =20 return parsed; } --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073914; cv=none; d=zohomail.com; s=zohoarc; b=C1qp8gqaeTkatGdb1MkdFrUWycnFNTX86TqOAJy0o8gRO0PuYrZp5jcVpEmwBLxj90prw4y+1g3QG/SIzymTjsKlDP0l+0AptfPfEd5lzHdKDlXBgqoVyG8kVWhvz/D5dH88MOvebNXzLdiva2ff5OfuYbKuRlxjqe9lDcftMFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073914; 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=guVoEdcg2Nyerp4c0LTMTYvEEa8Hd6Nvy/ES0ZsEgLg=; b=N5sxP+Ri6y4OnKClc/kyTfi7yc1kQXea41tUxIJWpSjzwgeQJ1ZmDEwTvMVRrCW9AkLZLpijsTiZ7FU8DpmvwJKpjhhCRnbQhzEIpVYiX7oFDzTPr9QX0DB18K33S3/DQyciIDY+69jud/yPgDzJV23sBOxhmGmz3f8O+UYCMtA= 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 1764073914416164.39597282675425; Tue, 25 Nov 2025 04:31:54 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id DE72541A9C; Tue, 25 Nov 2025 07:31:53 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id C910E44D5A; Tue, 25 Nov 2025 07:20:41 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 5527144C5A; Tue, 25 Nov 2025 07:20:28 -0500 (EST) 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 6A87D44A0C for ; Tue, 25 Nov 2025 07:18:29 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-79-yLy4T1oLMmO6EHoJ8okSCg-1; Tue, 25 Nov 2025 07:18:27 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D3EDC180034D for ; Tue, 25 Nov 2025 12:18:26 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 029CC180049F; Tue, 25 Nov 2025 12:18:25 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073109; 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=guVoEdcg2Nyerp4c0LTMTYvEEa8Hd6Nvy/ES0ZsEgLg=; b=LGkuCRFfA6KbZ6wea5DXjzpagZ6yXyYsqx+zs9bwLvUb4QjZdYSxs+upIU2RV7x77aIsQd CxIipXYg+D4GuwYCUjUMQ3jTitWFFjAtBoeL1WKalg+MVHhqQ42wnPuNeudAu7Wneczy7n Ub2n1RKKGgSBw6D0KaAMPrdtYLzaDso= X-MC-Unique: yLy4T1oLMmO6EHoJ8okSCg-1 X-Mimecast-MFC-AGG-ID: yLy4T1oLMmO6EHoJ8okSCg_1764073106 To: devel@lists.libvirt.org Subject: [PATCH v2 13/22] qemuMigrationAnyPrepareDef: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:43 +0100 Message-ID: <20251125121753.444490-14-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: QbbIu74X9DO7oJ8UUIZ9CZktKSrh3uKTzZaJcHlM2UU_1764073106 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: MI5S7JJFYIXR6UHGS6M6WASWYILLDRGU X-Message-ID-Hash: MI5S7JJFYIXR6UHGS6M6WASWYILLDRGU X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073915878019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_migration.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index d8c5f57d90..de7b6a8abf 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4034,7 +4034,7 @@ qemuMigrationAnyPrepareDef(virQEMUDriver *driver, int (*ensureACL)(virConnectPtr, virDomainDef *)) { virDomainDef *def; - char *name =3D NULL; + g_autofree char *name =3D NULL; =20 if (!dom_xml) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -4063,18 +4063,16 @@ qemuMigrationAnyPrepareDef(virQEMUDriver *driver, if (!(def =3D virDomainDefParseString(dom_xml, driver->xmlopt, qemuCaps, VIR_DOMAIN_DEF_PARSE_INACTIVE))) - goto cleanup; + return NULL; =20 if (dname) { name =3D def->name; def->name =3D g_strdup(dname); } =20 - cleanup: - if (def && origname) - *origname =3D name; - else - VIR_FREE(name); + if (origname) + *origname =3D g_steal_pointer(&name); + return def; } =20 --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764073990; cv=none; d=zohomail.com; s=zohoarc; b=guVqjSkePU1x09sQ86WurWy0btG/Jxd7ui407zbQ2lsquDwOp78/neOxy46tLZkz/Zzl8d41ostNG/bpTSgOyzEA3DZ+80Y/HwpJqzeyZ7HPmJhSqlDsfp7JPJ3OkvOjd/F+AYY66emKMG6ymWTrMopAuXk7EOPKsFMn5Iey0Ig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764073990; 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=ng3HRmrQfAWxq3t3OsaJN4hAZZglsb8iUY1YcmCbQ6Q=; b=Rk2xvtbTxOiF9mPByXGm8DpIfcl7ZNUiTAPLIPEzBk5UBW2P1SNPLd8ibTV/ChLrLV5sbThVz6XHVl76QjGIfSf2I2qsO9f0G1rSjBBqs3yzjamndxBnUt+TrNtHA6QtKjklTkmpdghtcoZWKonIiVtDURZnJv9A8qQo8BO+RCM= 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 176407398964294.68051253495526; Tue, 25 Nov 2025 04:33:09 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id E928141A9C; Tue, 25 Nov 2025 07:33:00 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 0C6DF44D8A; Tue, 25 Nov 2025 07:20:57 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 94B1B44AF7; Tue, 25 Nov 2025 07:20:45 -0500 (EST) 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 98AD944A63 for ; Tue, 25 Nov 2025 07:18:30 -0500 (EST) 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-353-tFTwM1DHPw2CYDv9fLZ5cw-1; Tue, 25 Nov 2025 07:18:28 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 1E5A31956075 for ; Tue, 25 Nov 2025 12:18:28 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3F764180049F; Tue, 25 Nov 2025 12:18:27 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073110; 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=ng3HRmrQfAWxq3t3OsaJN4hAZZglsb8iUY1YcmCbQ6Q=; b=itPm0gi5cGKGkPQrJTUxNQejlmrsSP/kFV3sotxyVoGb8RWFzABV3Twcmh8zyCVLC2BJyK o7TION/2G/LprWAxttaStyIuramW+0t7JXcU3we3Vbi53vOqQE3/YJeSbOHTq9dQsOpxZ7 Qpcwi3JHDA5AVHj9+QfAsJ11phJ2Ll8= X-MC-Unique: tFTwM1DHPw2CYDv9fLZ5cw-1 X-Mimecast-MFC-AGG-ID: tFTwM1DHPw2CYDv9fLZ5cw_1764073108 To: devel@lists.libvirt.org Subject: [PATCH v2 14/22] qemuMigrationSrcIOFunc: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:44 +0100 Message-ID: <20251125121753.444490-15-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: BkgXadfSamKb58uM7hstke-TWjpJw1fCVLMv9Jr9CH4_1764073108 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HSJXGM2TBNPDY5757NDFWBY3RJA2TYNR X-Message-ID-Hash: HSJXGM2TBNPDY5757NDFWBY3RJA2TYNR X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764073990522019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_migration.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index de7b6a8abf..39beecc7e9 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4348,7 +4348,7 @@ struct _qemuMigrationIOThread { static void qemuMigrationSrcIOFunc(void *arg) { qemuMigrationIOThread *data =3D arg; - char *buffer =3D NULL; + g_autofree char *buffer =3D NULL; struct pollfd fds[2]; int timeout =3D -1; virErrorPtr err =3D NULL; @@ -4426,7 +4426,6 @@ static void qemuMigrationSrcIOFunc(void *arg) goto error; =20 VIR_FORCE_CLOSE(data->sock); - VIR_FREE(buffer); =20 return; =20 @@ -4445,7 +4444,6 @@ static void qemuMigrationSrcIOFunc(void *arg) if (!virLastErrorIsSystemErrno(EPIPE)) virCopyLastError(&data->err); virResetLastError(); - VIR_FREE(buffer); } =20 =20 --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764074045; cv=none; d=zohomail.com; s=zohoarc; b=nYTA6fMSWaXGjjqnn49kgnrYfADns0M5161rruaf4BijtRlu92hulc+csy0uF18MH/RIq4rUXgsCwxnXRwyObwM/wdRSFtHCYOP+Di112zr9b+uGhhhFadzaghh7JNeMAYAuQb2NQ1NHCzxKIlMB8nQ2uGVTDyiLFECD+P1lcus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764074045; 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=WqTQ4JMPZ3clDQadCpwlC1x8ZkBywbmNzU/Zy6nxlUk=; b=Rk4jBiXWbHTmXOF9Gj+lCh0krO7cqwXcTuAHeMPAVOYhqyzS7XGTv5h9p+lyO+ekMqkFM87qGrDh1bZ4ND7/nvAd+flj6wZDRkCRF4WWnhrQWmR8dE1MwWAPqAGcbOouXlV7AVyWkOc0uq7oNnaduCYjDakH9HxOOfsEFl6Dkt4= 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 1764074045679644.3943373352423; Tue, 25 Nov 2025 04:34:05 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id F2D6D44313; Tue, 25 Nov 2025 07:34:04 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 4AD4B4487F; Tue, 25 Nov 2025 07:21:28 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id EFADD44848; Tue, 25 Nov 2025 07:21:10 -0500 (EST) 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 A53874487C for ; Tue, 25 Nov 2025 07:18:31 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-3-bZyC7HcyNDe4YrcDjNi_bQ-1; Tue, 25 Nov 2025 07:18:30 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5A03D18011EF for ; Tue, 25 Nov 2025 12:18:29 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7C4221800361; Tue, 25 Nov 2025 12:18:28 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073111; 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=WqTQ4JMPZ3clDQadCpwlC1x8ZkBywbmNzU/Zy6nxlUk=; b=dkdUmkHm2PLUyh1MSHhD1ddfvXfZ9a6TzrDzyUYq+R5YH+Q7/y2epc1FCnPl0C1isClZ1a wiotNCzWvdw5lxhgA+DB1WDAlT9eiWsBfOr3NleofFuP2IfdJTpvx5JZY319SYe0E2mJI+ eFAIKt0CcSeJJfrNnFf1o3JtjEX08B8= X-MC-Unique: bZyC7HcyNDe4YrcDjNi_bQ-1 X-Mimecast-MFC-AGG-ID: bZyC7HcyNDe4YrcDjNi_bQ_1764073109 To: devel@lists.libvirt.org Subject: [PATCH v2 15/22] qemuMigrationSrcStartTunnel: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:45 +0100 Message-ID: <20251125121753.444490-16-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Dovq0SP4AzzE-ah39wsqj6qde9MqBZjyjjL2GHwHslo_1764073109 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: N3CTYDZIT255H63HT377KC745CZ5YDZH X-Message-ID-Hash: N3CTYDZIT255H63HT377KC745CZ5YDZH X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764074046887019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_migration.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 39beecc7e9..06b8f388fe 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4451,7 +4451,7 @@ static qemuMigrationIOThread * qemuMigrationSrcStartTunnel(virStreamPtr st, int sock) { - qemuMigrationIOThread *io =3D NULL; + g_autofree qemuMigrationIOThread *io =3D NULL; int wakeupFD[2] =3D { -1, -1 }; =20 if (virPipe(wakeupFD) < 0) @@ -4474,12 +4474,11 @@ qemuMigrationSrcStartTunnel(virStreamPtr st, goto error; } =20 - return io; + return g_steal_pointer(&io); =20 error: VIR_FORCE_CLOSE(wakeupFD[0]); VIR_FORCE_CLOSE(wakeupFD[1]); - VIR_FREE(io); return NULL; } =20 --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764074126; cv=none; d=zohomail.com; s=zohoarc; b=XBCQM365Np9kaKX1j8kUBQ7EnBzxh0vLBhbiXHQTCwmM5bZmIo/DkpunK1l9zLK6zBlIiuRlLAnzVv/V8ZcqFNA8pyHmlu4ldVKC7wMUVOAkHYS4b7rcMiTFKH5XHIsgGh25e+TTv7E1TH7FuwfWqnLH94LfkhJ78OuAh31Ydag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764074126; 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=mBiUwA7MFmmjqhmO/1AFRyAFJM40niRGntAL+mA4r/g=; b=gWMg//y0CWm3AmD09DErOVyYZ7XMXfizhUo9D7A0sTpxtWSg3rTs5e76vmqXq5+1Q9jKZ1pr68Vb3kHFTZictVfe4rvEdCUVcg4WLpbPnI5N6sUEF3t5vEC/3GwWSMIj3SFIPPSVVvG/gyhZr4PgjaD2wwtiX3tmyGx7T70CXlw= 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 1764074126933924.8448537208193; Tue, 25 Nov 2025 04:35:26 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 6348C44BFE; Tue, 25 Nov 2025 07:35:24 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 172EB44E16; Tue, 25 Nov 2025 07:21:38 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id B837244B2D; Tue, 25 Nov 2025 07:21:28 -0500 (EST) 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 C715944B2D for ; Tue, 25 Nov 2025 07:18:32 -0500 (EST) Received: from mx-prod-mc-05.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-31-23FCzi3tPO6lqeCsOLY-OQ-1; Tue, 25 Nov 2025 07:18:31 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9805319560AF for ; Tue, 25 Nov 2025 12:18:30 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B9519180049F; Tue, 25 Nov 2025 12:18:29 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073112; 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=mBiUwA7MFmmjqhmO/1AFRyAFJM40niRGntAL+mA4r/g=; b=fpe8ESQ0RWEA1CHVCs4iJJqVoqxytvPJBqQMTuikDRVwMWoQNHpkQyD69JKZP5Y7SAf0pk elsFvQCjIymv+tA6SWRlquJXfH/RAP08bCU/bnezHw84qiovKrWY8r950WFlgAlknmnWwv spyhAHzX8Kbv1ZvPHbq7THUNRepFdJA= X-MC-Unique: 23FCzi3tPO6lqeCsOLY-OQ-1 X-Mimecast-MFC-AGG-ID: 23FCzi3tPO6lqeCsOLY-OQ_1764073110 To: devel@lists.libvirt.org Subject: [PATCH v2 16/22] qemuMigrationSrcToLegacyFile: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:46 +0100 Message-ID: <20251125121753.444490-17-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: FuU2cV1Vo9piHWkGArKKd0nB36EdiDlYtGvwa5KlwNE_1764073110 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: VYXGP746PMI7QZQTIM3H7PYMGAAFJC64 X-Message-ID-Hash: VYXGP746PMI7QZQTIM3H7PYMGAAFJC64 X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764074127625019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_migration.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 06b8f388fe..ef56482e82 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -7142,7 +7142,7 @@ qemuMigrationSrcToLegacyFile(virQEMUDriver *driver, qemuDomainObjPrivate *priv =3D vm->privateData; int ret =3D -1; int pipeFD[2] =3D { -1, -1 }; - char *errbuf =3D NULL; + g_autofree char *errbuf =3D NULL; =20 if (compressor && virPipe(pipeFD) < 0) return -1; @@ -7188,7 +7188,6 @@ qemuMigrationSrcToLegacyFile(virQEMUDriver *driver, =20 if (errbuf) { VIR_DEBUG("Compression binary stderr: %s", NULLSTR(errbuf)); - VIR_FREE(errbuf); } =20 return ret; --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764074198; cv=none; d=zohomail.com; s=zohoarc; b=XCGe8L3ga3m/91+2QNloOgV6YCT8OUEjfiIXkcMHJlAMzAqwdzxrOpPkVZSIiPof7gOQSFiB+ffpCcy+ZjusbfWFJak+zbIUZTH7PHShXINHEj6X2Hpth/8EMxcQSVG98xDJzFdfA8FfioIqjk9azYbH85c38vuwSSjlHYxonHk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764074198; 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=OWu/3pnwhlCxpKNIXr3F9VSYFXDCsjmI0I3c2ETieGo=; b=VT2lUPgGExVdUWJyrnSfxQpq9bH5XwrktLW9AlUJ4EcHFIWqvBAOQxqtnKN2kXY5d4J1ngifYU0qxVtzZvm/JcvkVjKsESJ3vfXAdPYtWVjIsEWhl4bTW4NoPKYBuVLWzH6YLzbSPi+v1/gOrUgp4WegsuUAt7VTAIXkCpdKO8s= 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 176407419892511.533437863720792; Tue, 25 Nov 2025 04:36:38 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 2A42344840; Tue, 25 Nov 2025 07:36:38 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 1BA0A44E41; Tue, 25 Nov 2025 07:21:56 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 251CB44B07; Tue, 25 Nov 2025 07:21:47 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 3A59A44B47 for ; Tue, 25 Nov 2025 07:18:34 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-5sd1vXPGPpeV-pqrcBPBqQ-1; Tue, 25 Nov 2025 07:18:32 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CA9AC18001FE for ; Tue, 25 Nov 2025 12:18:31 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 024CA18002A6; Tue, 25 Nov 2025 12:18:30 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073113; 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=OWu/3pnwhlCxpKNIXr3F9VSYFXDCsjmI0I3c2ETieGo=; b=F1ODS8dy2+Ka3QskQ19SReUID/ohe64LtNNaqYe3XU79+SSSHXKRbazzUpQyMrVfXtYwYl ryNQnJQdtxyqCAlCLj1lJWlwjNwBGzc8z1CYNJRzB8Cj0cULUwcLnBMtNaxN/3r81pu23T yv1HLSneNXgyxKEMFDgtZTFMMQVzt74= X-MC-Unique: 5sd1vXPGPpeV-pqrcBPBqQ-1 X-Mimecast-MFC-AGG-ID: 5sd1vXPGPpeV-pqrcBPBqQ_1764073111 To: devel@lists.libvirt.org Subject: [PATCH v2 17/22] virDomainGraphicsDefNew: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:47 +0100 Message-ID: <20251125121753.444490-18-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: zGU9W8yFRbwCw14m5RQ1PL_04SL9h3Bh9drOByaJsaw_1764073111 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: A4WYYKRH7YCS5SUO36I5ORU7XNJCKOIK X-Message-ID-Hash: A4WYYKRH7YCS5SUO36I5ORU7XNJCKOIK X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764074200144019201 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/conf/domain_conf.c | 6 +++--- src/conf/domain_conf.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 541dad5bdc..02f55ade44 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12277,16 +12277,16 @@ virDomainGraphicsDefParseXMLDBus(virDomainGraphic= sDef *def, virDomainGraphicsDef * virDomainGraphicsDefNew(virDomainXMLOption *xmlopt) { - virDomainGraphicsDef *def =3D NULL; + g_autoptr(virDomainGraphicsDef) def =3D NULL; =20 def =3D g_new0(virDomainGraphicsDef, 1); =20 if (xmlopt && xmlopt->privateData.graphicsNew && !(def->privateData =3D xmlopt->privateData.graphicsNew())) { - VIR_FREE(def); + return NULL; } =20 - return def; + return g_steal_pointer(&def); } =20 =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cb35ff06bd..185fc959aa 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3726,6 +3726,7 @@ int virDomainObjWaitUntil(virDomainObj *vm, void virDomainPanicDefFree(virDomainPanicDef *panic); void virDomainResourceDefFree(virDomainResourceDef *resource); void virDomainGraphicsDefFree(virDomainGraphicsDef *def); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainGraphicsDef, virDomainGraphicsDefFr= ee); const char *virDomainInputDefGetPath(virDomainInputDef *input); void virDomainInputDefFree(virDomainInputDef *def); virDomainDiskDef *virDomainDiskDefNew(virDomainXMLOption *xmlopt); --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764074281; cv=none; d=zohomail.com; s=zohoarc; b=AA54/FREqC7W5VNIOMzUoxQ95tAkM0ysKS0JdmejPdqUjPoFRsKV1d4pHTny6hNTWHJ6sIlfzKmPXRA3+CK/sjgPYCouZ8qdTAFRXwGNPGCKkscxkuvwG05OypaBfMhlny4vFuy9tD2+3Fxo/L4hL5F1ek78+hGoR79/O7djZ2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764074281; 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=JDEP1KDWv1wq1hYQGzQtNTl/gYQjPfCnf62oHa61Udw=; b=Aju3BTDpc9z+AaYEonTSc9fYwNRlLRCsb7liX0m0UlqECkCEob58CmxhQBsolUW/bItxKklOItD5QRN8nbdYoP42OGky9A71E2G2KFcBon/6x0AVqQwu9mKJj+br7nOy+SqgrgT/5GAl8fE9zwUh6iznlGUDQcPryU6bfgADqJU= 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 1764074281217727.9079803281995; Tue, 25 Nov 2025 04:38:01 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 157B941C42; Tue, 25 Nov 2025 07:37:59 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 7B1AB44BB6; Tue, 25 Nov 2025 07:24:07 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 784B944242; Tue, 25 Nov 2025 07:22:05 -0500 (EST) 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 2AFFD448D5 for ; Tue, 25 Nov 2025 07:18:35 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-385-nyyOQjT5MAyywjGUoZnXKQ-1; Tue, 25 Nov 2025 07:18:33 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0A89C1800EF6 for ; Tue, 25 Nov 2025 12:18:33 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 34FF5180047F; Tue, 25 Nov 2025 12:18:32 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073114; 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=JDEP1KDWv1wq1hYQGzQtNTl/gYQjPfCnf62oHa61Udw=; b=X9prEMGToAGlfmz1F2xLgTpbdIxB50xCgEEnFcLxVmoBqGUzGo76ZOEm0n/PsL8MhLnJoy Ghk2prEEegkync5Mv1jgI2yvw32xf49VTUlxNL+u8fk7lCQTCvyG6pFnT7D0pSCvTcwcKJ fdjksaxzlMqIWtKxwLS7jk4nVg6g1Ko= X-MC-Unique: nyyOQjT5MAyywjGUoZnXKQ-1 X-Mimecast-MFC-AGG-ID: nyyOQjT5MAyywjGUoZnXKQ_1764073113 To: devel@lists.libvirt.org Subject: [PATCH v2 18/22] virDomainTPMDefNew: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:48 +0100 Message-ID: <20251125121753.444490-19-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: nHSkO3Dr3fkpqy0fo2A295M7UzlG4WbQkXUWGl-l0CI_1764073113 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 6SEUNYVRGM3YXYFGRXTO4DRDBJ323MQC X-Message-ID-Hash: 6SEUNYVRGM3YXYFGRXTO4DRDBJ323MQC X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764074282845019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/conf/domain_conf.c | 5 ++--- src/conf/domain_conf.h | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 02f55ade44..14fb82e296 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3498,17 +3498,16 @@ virDomainHostdevDefNew(void) static virDomainTPMDef * virDomainTPMDefNew(virDomainXMLOption *xmlopt) { - virDomainTPMDef *def; + g_autoptr(virDomainTPMDef) def =3D NULL; =20 def =3D g_new0(virDomainTPMDef, 1); =20 if (xmlopt && xmlopt->privateData.tpmNew && !(def->privateData =3D xmlopt->privateData.tpmNew())) { - VIR_FREE(def); return NULL; } =20 - return def; + return g_steal_pointer(&def); } =20 void virDomainTPMDefFree(virDomainTPMDef *def) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 185fc959aa..ec68776653 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3812,6 +3812,7 @@ virDomainDeviceInfo *virDomainDeviceGetInfo(const vir= DomainDeviceDef *device); void virDomainDeviceSetData(virDomainDeviceDef *device, void *devicedata); void virDomainTPMDefFree(virDomainTPMDef *def); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainTPMDef, virDomainTPMDefFree); =20 typedef int (*virDomainDeviceInfoCallback)(virDomainDef *def, virDomainDeviceDef *dev, --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764074355; cv=none; d=zohomail.com; s=zohoarc; b=kNc9HdNW3xhFCMShw441P5v5jWlLLwV5DCvcoPfqAnqG7W1xmQGOMAXP0Hx05S3rWam9nx3prbsQMu5mj+qI8/wnTd8fUMpqFjmiCGN471QUZR3UHlZFUR6krszToGtS+A0WrBGYSwc7Hdo1rKyajvxcRLjTb/cMi64lJwtZnqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764074355; 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=j1m0b2KEVfOlRxXBLyLM4Cb6/my6mwKrVu1QdDG7fuY=; b=LmotuCn6W1sSTEDN9+H1OpqhNKdDgpPdoZiDn4Txl4Bt4N4FwtAE2qe+CKPNscz74FkuDC0uj0UwjEtXRKgWjnuX4uvSvSCKBqmEhBVmSsPK6jFU9B97ax0T33eBy4itbe8vMW7fDs/Z4RYhNSSZ//YtkgPzFCMls4gilu+GJm8= 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 1764074355350409.62141399353686; Tue, 25 Nov 2025 04:39:15 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id BAEE341C1C; Tue, 25 Nov 2025 07:39:14 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 52E0244048; Tue, 25 Nov 2025 07:28:07 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id CA80E448C7; Tue, 25 Nov 2025 07:22:43 -0500 (EST) 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 30D2B44B7B for ; Tue, 25 Nov 2025 07:18:37 -0500 (EST) Received: from mx-prod-mc-05.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-287-8ptgZb3FM_uVLWY4GXL7YA-1; Tue, 25 Nov 2025 07:18:35 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 476771956088 for ; Tue, 25 Nov 2025 12:18:34 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6860A180049F; Tue, 25 Nov 2025 12:18:33 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073116; 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=j1m0b2KEVfOlRxXBLyLM4Cb6/my6mwKrVu1QdDG7fuY=; b=UcuaSYAR4Kx1sclJU/EiiZcuY0MFm4j+NoOycYefF8Q19eYddlv98dm/dN8c7xuO5Z/W16 ynq91aOXbMWXUMfif2OuTyHYPWsvmPutRJIdQISumXOaELHgK29W+xU6uQR4x7doba9DNP e/NcevDIg9GuNJ+WUst2n0gcJipRs/c= X-MC-Unique: 8ptgZb3FM_uVLWY4GXL7YA-1 X-Mimecast-MFC-AGG-ID: 8ptgZb3FM_uVLWY4GXL7YA_1764073114 To: devel@lists.libvirt.org Subject: [PATCH v2 19/22] virDomainVideoDefNew: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:49 +0100 Message-ID: <20251125121753.444490-20-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: OW9m3uPqxonXzshy4QiRUIp7KA4B67muPGo6a2Fv1xc_1764073114 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: AZ3VH7DUPSMMQ73YPRNAMDLC3MITDHZF X-Message-ID-Hash: AZ3VH7DUPSMMQ73YPRNAMDLC3MITDHZF X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764074357294019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/conf/domain_conf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 14fb82e296..0b36a71dba 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3435,18 +3435,17 @@ void virDomainShmemDefFree(virDomainShmemDef *def) virDomainVideoDef * virDomainVideoDefNew(virDomainXMLOption *xmlopt) { - virDomainVideoDef *def; + g_autoptr(virDomainVideoDef) def =3D NULL; =20 def =3D g_new0(virDomainVideoDef, 1); =20 if (xmlopt && xmlopt->privateData.videoNew && !(def->privateData =3D xmlopt->privateData.videoNew())) { - VIR_FREE(def); return NULL; } =20 def->heads =3D 1; - return def; + return g_steal_pointer(&def); } =20 =20 --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764074396; cv=none; d=zohomail.com; s=zohoarc; b=gefHe32lAuxK/mXf6TUwm3yYYRG6PDGktNwFGxgv97/YiFpbli/GFc5Ffwu7+8kh0LLM3dBOg3BedzOi5YSQDHOyFrkA/eHPB4A6ZJcE3g8Nm4vdjropZago1CmkBBaKvku9rX9jx2n3woN8A6y8m0oY1VS5iz4D9sJjgLZpMd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764074396; 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=tWBMxKw8MoHCvkGXmqj++Q230eJKJsSxvGB7/cIiqpA=; b=EgH3TvJMt5U6dlYUqH9wSYnPtOYHpW0R4A8KIPDF+21NDNZZZRJ8//vbwsfhmYhJR2h7Oz4Zhhe6uYO5Ua410rJvDhstSKuOTDo2ZKPr/ObGKD+Ijc0dQAla4pO64AEX1nV6Q8aLRZqReX8OhmbRiy8NYx0twwn1PEM6gGjCAiw= 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 1764074396546680.4844144039859; Tue, 25 Nov 2025 04:39:56 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id E76F344AB0; Tue, 25 Nov 2025 07:39:55 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id B1A8D44BE3; Tue, 25 Nov 2025 07:28:21 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 19C6D44B84; Tue, 25 Nov 2025 07:22:56 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 CD5AB44B87 for ; Tue, 25 Nov 2025 07:18:37 -0500 (EST) 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-654-bvb202zhOLWd3SJGGPnY-g-1; Tue, 25 Nov 2025 07:18:36 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 85A7D1956059 for ; Tue, 25 Nov 2025 12:18:35 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A645E180047F; Tue, 25 Nov 2025 12:18:34 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073117; 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=tWBMxKw8MoHCvkGXmqj++Q230eJKJsSxvGB7/cIiqpA=; b=ZpvGVW5l2/22kTpDXOK22cU2XYPc0wJWj5NZNQQZYkzmmoCZAuss5+/IYizfthW5nUkFmh nVJH1lcJuwyiRazKAB7FyKLleFmiozqN6vbzvNk+/rPzOSLdaT3d6N2SCyezYWEfRCCwBz fRehvppbyCaIqZfV5sLTKDPO+aSlTBw= X-MC-Unique: bvb202zhOLWd3SJGGPnY-g-1 X-Mimecast-MFC-AGG-ID: bvb202zhOLWd3SJGGPnY-g_1764073115 To: devel@lists.libvirt.org Subject: [PATCH v2 20/22] virDomainIdmapDefParseXML: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:50 +0100 Message-ID: <20251125121753.444490-21-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: cYUbdRkfpIc8BZ7ABA1IpMqrgnBJdk2H9hmKq-iyuBM_1764073115 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BQFZTJMCCJUT25GIMSWIVZKXSXQY5HKT X-Message-ID-Hash: BQFZTJMCCJUT25GIMSWIVZKXSXQY5HKT X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764074397730019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/conf/domain_conf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0b36a71dba..d41dd4a829 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9187,7 +9187,7 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt, size_t num) { size_t i; - virDomainIdMapEntry *idmap =3D NULL; + g_autofree virDomainIdMapEntry *idmap =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) =20 idmap =3D g_new0(virDomainIdMapEntry, num); @@ -9199,14 +9199,13 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt, virXPathUInt("string(./@count)", ctxt, &idmap[i].count) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("invalid idmap start/target/count settings")); - VIR_FREE(idmap); return NULL; } } =20 g_qsort_with_data(idmap, num, sizeof(idmap[0]), virDomainIdMapEntrySor= t, NULL); =20 - return idmap; + return g_steal_pointer(&idmap); } =20 =20 --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764074447; cv=none; d=zohomail.com; s=zohoarc; b=D7vArnQkebar1EAHGie7jSpfG5sHVi2Q1liC08hbRhG1NcXx5behkcf8mqLWm2Obn9NhNfT9SU626jEDR8445NuaEBoRATLhlSsBZ23Idt9BRfQXM4EnMx4WAo53B3qD2L7Q2QhGIJmfNFCaqt7Ji+4DCTbjaQEHOw5bk6Ub/sU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764074447; 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=nF609xB+cgezavDrZ1eHdA+hMEDQpa8Oe2wuy/1LG2g=; b=cA4QDPgxmmdZx5YUARnCLaH2DLKDmkAoC14PncKu2F2mrWeNzDnWKJj/hWN9/q5OqEu4YLth+eEPyuAGrTOAjRXz7IgJOVqYvn5Tvbf3duGSyIUZYmZB9VO5xa+ZUe+iNiSbinCfSzPDLALtUlcanHFqqHwvTPa8/cnNC3KgB5Y= 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 1764074447749524.085951748854; Tue, 25 Nov 2025 04:40:47 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 1C9B641975; Tue, 25 Nov 2025 07:40:47 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id EBFB644DEE; Tue, 25 Nov 2025 07:28:27 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 2430B4433E; Tue, 25 Nov 2025 07:23:06 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 F3EFA44962 for ; Tue, 25 Nov 2025 07:18:38 -0500 (EST) Received: from mx-prod-mc-01.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-86-ncqd-JT5Pm2YW8tgRWnEZA-1; Tue, 25 Nov 2025 07:18:37 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C28B61954204 for ; Tue, 25 Nov 2025 12:18:36 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E37B2180049F; Tue, 25 Nov 2025 12:18:35 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073118; 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=nF609xB+cgezavDrZ1eHdA+hMEDQpa8Oe2wuy/1LG2g=; b=QfATH4O/Ycd3PB2D8cfHdvSUPWqHqKExEt9KtZsKZurYFUaQhLzER0teH1GflT+JsbgS8h XtOBwyxIXtVbBrvUrHXaQKrtuYOVe74ADBn1fEzI6VMUx/AcYPZp3rycE23ZB+QEocQRUd RL7Pldu7YQ/+TEnTnn7galD0JxfAd/A= X-MC-Unique: ncqd-JT5Pm2YW8tgRWnEZA-1 X-Mimecast-MFC-AGG-ID: ncqd-JT5Pm2YW8tgRWnEZA_1764073116 To: devel@lists.libvirt.org Subject: [PATCH v2 21/22] virDomainNetAppendIPAddress: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:51 +0100 Message-ID: <20251125121753.444490-22-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: pXEJ2TkMnFNOdwNBluwDYQpgWB2jZN3EHmCNkJB9Vtg_1764073116 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: D6UM3RCJL4IMQCZCUH42NB4SZJDC6U5Y X-Message-ID-Hash: D6UM3RCJL4IMQCZCUH42NB4SZJDC6U5Y X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764074448367019200 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/conf/domain_conf.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d41dd4a829..1d983a636f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9640,20 +9640,16 @@ virDomainNetAppendIPAddress(virDomainNetDef *def, int family, unsigned int prefix) { - virNetDevIPAddr *ipDef =3D NULL; + g_autofree virNetDevIPAddr *ipDef =3D NULL; ipDef =3D g_new0(virNetDevIPAddr, 1); =20 if (virSocketAddrParse(&ipDef->address, address, family) < 0) - goto error; + return -1; ipDef->prefix =3D prefix; =20 VIR_APPEND_ELEMENT(def->guestIP.ips, def->guestIP.nips, ipDef); =20 return 0; - - error: - VIR_FREE(ipDef); - return -1; } =20 =20 --=20 2.49.0 From nobody Fri Dec 12 12:53:53 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=1764074505; cv=none; d=zohomail.com; s=zohoarc; b=gXqW1G1m8ksao5eIdW3/084kakCAAl7q5+6lE/JPuIAQcevGxj9MdYzC6iAvKrKU6QkLR1ogRkwh0ArP+ZD3K0qvya+XAW2MQ5S44LSWlHa6qs42U9+JhTf0tzjSRCvifYVXRGSA585GZOpKL2boPq3GrLeBHJm/gpP2ai+PpsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764074505; 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=DZjpCJAfES6zuGJ6IaZ9vkr1UvhkDkhb/uhqi8GTeoU=; b=W/FbXc7ymkuFZOa8/cWotvnO5Obs15LAoTsudTyhGx8licZRvYjKKcN6iMX188r84Opz/KMgdfpmjlbhgWKln+fXXdZYcOGs41am5NVX8MFyyT4I+QdXIb9ko7o3U70yDxybh7XpQJaTNTwLc5Rw5o7sXjBVn5zCZ1ARO+qLegY= 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 1764074505753856.6081025368994; Tue, 25 Nov 2025 04:41:45 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 2592C41AB3; Tue, 25 Nov 2025 07:41:44 -0500 (EST) Received: from [172.19.199.68] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 0F4B644E65; Tue, 25 Nov 2025 07:28:32 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id E52F344B63; Tue, 25 Nov 2025 07:23:44 -0500 (EST) 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 713E444BA8 for ; Tue, 25 Nov 2025 07:18:40 -0500 (EST) Received: from mx-prod-mc-01.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-475-VbKTumNHN7evsW5ujPBYmg-1; Tue, 25 Nov 2025 07:18:38 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0C95D195423A for ; Tue, 25 Nov 2025 12:18:38 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.3.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2CC8C180049F; Tue, 25 Nov 2025 12:18:36 +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=-5.0 required=5.0 tests=BAYES_00,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=1764073120; 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=DZjpCJAfES6zuGJ6IaZ9vkr1UvhkDkhb/uhqi8GTeoU=; b=fz23VSMFt9UbVOyAMDCPfYpldQomdJbX/iKbe1bCKfk2zLwwLATx4M5xQYH1kGyHKlB4H3 Rx5pbb8KaM94AAbsbXp+PbyfhBbckP+2tiHPG8wOTCHn2+bc5tet2J1T9bEYRjwPPF236k q4oSu85VR/hsSO9LduEi8IhOnXfZKX4= X-MC-Unique: VbKTumNHN7evsW5ujPBYmg-1 X-Mimecast-MFC-AGG-ID: VbKTumNHN7evsW5ujPBYmg_1764073118 To: devel@lists.libvirt.org Subject: [PATCH v2 22/22] virDomainChrDefNew: Use automatic memory management Date: Tue, 25 Nov 2025 13:11:52 +0100 Message-ID: <20251125121753.444490-23-kshcheti@redhat.com> In-Reply-To: <20251125121753.444490-1-kshcheti@redhat.com> References: <20251125121753.444490-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 6t80joN2gqvEGIKcm69xpZ3futeojRSgj0IBaO9jhDU_1764073118 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: OG4F6QQCX5YYWWNUBCMGJNCKBQLFC2KA X-Message-ID-Hash: OG4F6QQCX5YYWWNUBCMGJNCKBQLFC2KA X-MailFrom: kshcheti@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: Kirill Shchetiniuk 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: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1764074506948019201 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Signed-off-by: Kirill Shchetiniuk --- src/conf/domain_conf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1d983a636f..01a9b070f6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10949,16 +10949,16 @@ virDomainChrSourceDefNew(virDomainXMLOption *xmlo= pt) virDomainChrDef * virDomainChrDefNew(virDomainXMLOption *xmlopt) { - virDomainChrDef *def =3D NULL; + g_autoptr(virDomainChrDef) def =3D NULL; =20 def =3D g_new0(virDomainChrDef, 1); =20 def->target.port =3D -1; =20 if (!(def->source =3D virDomainChrSourceDefNew(xmlopt))) - VIR_FREE(def); + return NULL; =20 - return def; + return g_steal_pointer(&def); } =20 /* Parse the XML definition for a character device --=20 2.49.0