From nobody Sun May 19 06:23:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674728985; cv=none; d=zohomail.com; s=zohoarc; b=BrWX+RNhB6MluyMwnHTfNQvsFVDYM+cAMSA53c2J6RpUDnbvcIMPmiDPNdNBPcBfJzTt1dHpTNakEEKQeiI+cz0D6XOFJAP4iEjlJZsDJaSgwEKi1mUYW/dIkbZVZu6xUknj1cHTy3sV0FmwHPZLLuLiDr59/ysKtIdUN7iaynA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674728985; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OVrimtqn5tuWehaUBJC/M9rLjDxJZrXJLazZ+8cYljw=; b=Y/9HMQwmaRNBFb2KGDQEBPzTdBuI+E2Jli/cw7FN4XYrP+4n5kTDneyPBWBG2VXHleJR590+aL7BK2U4VtQbmfeJE6FmK57rZbtceE73Q6C7m3TyF5+Qnz9+uZbK1KIZO4oT6849fsEozFS7AWTnw2Y8s+cIs5psUgmnYFEOJTI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1674728985644571.1620050491451; Thu, 26 Jan 2023 02:29:45 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-284-3-m-Me_YNvO8oOtjk-i1Yg-1; Thu, 26 Jan 2023 05:29:39 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1FEF985C6E9; Thu, 26 Jan 2023 10:29:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 078AF4015312; Thu, 26 Jan 2023 10:29:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7FF3C1946594; Thu, 26 Jan 2023 10:29:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BE7D81946597 for ; Thu, 26 Jan 2023 10:29:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B454E492C18; Thu, 26 Jan 2023 10:29:27 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7761C492C14 for ; Thu, 26 Jan 2023 10:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674728984; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=OVrimtqn5tuWehaUBJC/M9rLjDxJZrXJLazZ+8cYljw=; b=dg1y3EN71lNetGUeM94DkFj4lZKJexGZ8nUClsU6uqSMqloIMx7nJDnKoB6YL611wu5yaY 0/XxGv1WIZvHmwBhz+NBXuvsdYCh2VVwIg09Xk2QtwJDOncpCHeNnStAbP9CuSZ+033Nmc zqh+uaVbbsydXp/L5uSOV4SObao0qpA= X-MC-Unique: 3-m-Me_YNvO8oOtjk-i1Yg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] remote: Propagate error from virDomainGetSecurityLabelList via RPC Date: Thu, 26 Jan 2023 11:29:21 +0100 Message-Id: <5a167e1ae7dbf12b622272aa9aa8a8d973bee479.1674728899.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674728987050100004 Content-Type: text/plain; charset="utf-8" The daemon side of this API has been broken ever since the API was introduced in 2012. Instead of sending the error from virDomainGetSecurityLabelList via RPC so that the client can see it, the dispatcher would just send a successful reply with return value set to -1 (and an empty array of labels). The client side would propagate this return value so the client can see the API failed, but the original error would be lost. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/remote/remote_daemon_dispatch.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 6c56e9ec3e..4d993afee6 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -2637,13 +2637,11 @@ remoteDispatchDomainGetSecurityLabelList(virNetServ= er *server G_GNUC_UNUSED, if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 - if ((len =3D virDomainGetSecurityLabelList(dom, &seclabels)) < 0) { - ret->ret =3D len; - ret->labels.labels_len =3D 0; - ret->labels.labels_val =3D NULL; - goto done; - } + if ((len =3D virDomainGetSecurityLabelList(dom, &seclabels)) < 0) + goto cleanup; =20 + ret->ret =3D len; + ret->labels.labels_len =3D len; ret->labels.labels_val =3D g_new0(remote_domain_get_security_label_ret= , len); =20 for (i =3D 0; i < len; i++) { @@ -2653,9 +2651,7 @@ remoteDispatchDomainGetSecurityLabelList(virNetServer= *server G_GNUC_UNUSED, cur->label.label_len =3D label_len; cur->enforcing =3D seclabels[i].enforcing; } - ret->labels.labels_len =3D ret->ret =3D len; =20 - done: rv =3D 0; =20 cleanup: --=20 2.39.1 From nobody Sun May 19 06:23:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674729004; cv=none; d=zohomail.com; s=zohoarc; b=WbBqc2i0f8P1FI1QV6a3eIwE8z2dgzZEDZg9bORbB/7iHuBRLLMnjgv61YaactSWV/3sCs2qWUVlbgv7FW6B91C82Vi/RFgDBwOQ1iiNRhL/x38PzzT9FLWTasRxsfrew5jDU/+ljFpLvThmpTeug+4IExDl7OhC6MWIaR01biY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674729004; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rwqQlrxIlg9oAfaQfR5TQr72LiTDEVBDXmZiUYflVck=; b=HgjUyLyuUAbIMASUVSkUlwOJpxyGJunGapl97GYbcXjHqXQQbVQQxR/y4th8juhpVA2dJ3olWmwJ7BYmUr5f3IeimPHSckUri3l29rj/NUpJmAd5B8K4FSgSZrnwS1sNbgMPd7aXxlBb1spSMBjTEyIwRW+pJaIbX2DsZv3DX2c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1674729004367622.5072408817583; Thu, 26 Jan 2023 02:30:04 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-376-8ucyUN9MMdmLZhuqztQuZg-1; Thu, 26 Jan 2023 05:29:39 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F07131C0755E; Thu, 26 Jan 2023 10:29:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CA5C492B01; Thu, 26 Jan 2023 10:29:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 11BED1946A47; Thu, 26 Jan 2023 10:29:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BDD7E1946595 for ; Thu, 26 Jan 2023 10:29:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A24491401C33; Thu, 26 Jan 2023 10:29:28 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64FE9140EBF5 for ; Thu, 26 Jan 2023 10:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674729003; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rwqQlrxIlg9oAfaQfR5TQr72LiTDEVBDXmZiUYflVck=; b=aOOkzemLUR1In8Vz4ioNauap/73Ff4w1owePvfaAUSFaZoAhkd4Ak0dgUaT0S+5xf+u2zH Ag1niCJvT9W1Y0o6Q46Sdh8vZVyMSx/yX3T2X0zvawLEs1m29GqQbU0xNTOnBoeumZKGz5 Ialjssn4cJJoHDCDAStDulQ4a3GkRNE= X-MC-Unique: 8ucyUN9MMdmLZhuqztQuZg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] remote: Drop useless check in remoteDispatchDomainGetIOThreadInfo Date: Thu, 26 Jan 2023 11:29:22 +0100 Message-Id: <78e435d6579287b762047e8b8491a234b17391ca.1674728899.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674729005061100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/remote/remote_daemon_dispatch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 4d993afee6..dbe6825fb8 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -2968,9 +2968,8 @@ remoteDispatchDomainGetIOThreadInfo(virNetServer *ser= ver G_GNUC_UNUSED, if (rv < 0) virNetMessageSaveError(rerr); virObjectUnref(dom); - if (ninfo >=3D 0) - for (i =3D 0; i < ninfo; i++) - virDomainIOThreadInfoFree(info[i]); + for (i =3D 0; i < ninfo; i++) + virDomainIOThreadInfoFree(info[i]); VIR_FREE(info); =20 return rv; --=20 2.39.1 From nobody Sun May 19 06:23:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674728983; cv=none; d=zohomail.com; s=zohoarc; b=ObO3n8hpj9pjZZGgDKqn5NuLCPv0EwtOQGjBTaa3pMT77ZtS7Q7cvKmvJXIRvNEHjKb3vsNcCod3wkaOBS+Zdbn3r3agcNqIJwGvuGzIU/08CdnUYA3ISXuhJYviVLU/GJYP+qkR1fF/c8USpNV6pNIscZ9Ni467juUTqx3b6kE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674728983; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3AIC8BETkG9tanf5vd4XSKdtf9oFmCVRaDqUzL7hJas=; b=BV+tHqjk8AOldW0rTRr0zEgCNzYznBRCdtSZfkAitR20nh+j596zvi4fGRPI7VBtp7j1ZgukwPOCpv8I6Ygumd+Vvj9O3328Y80n+LU7FimmDyAEFdOrgZLOqkA6yk9bJ2TW//tNcdYzT3W4Op/GEgswpnU5WDqhQUEnMiVaWys= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1674728983272389.4434076634693; Thu, 26 Jan 2023 02:29:43 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-137-opDnOLvZNqyRnN7VSCr8YQ-1; Thu, 26 Jan 2023 05:29:40 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3387A805579; Thu, 26 Jan 2023 10:29:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDB151121333; Thu, 26 Jan 2023 10:29:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CEFE119465B9; Thu, 26 Jan 2023 10:29:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BB984194658D for ; Thu, 26 Jan 2023 10:29:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 92AEF2026D2A; Thu, 26 Jan 2023 10:29:29 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55D502026D76 for ; Thu, 26 Jan 2023 10:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674728982; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=3AIC8BETkG9tanf5vd4XSKdtf9oFmCVRaDqUzL7hJas=; b=UjykDWJt2y3B5KnikvSpggO81ZeGEcsF1rHI6hGfossw/tAaX9EXuo8PQpNjNClZ2qcl3e TsjejaahLbxlZvmWMLgC0vwK4Ea0NvoqBW7JBbF9ZpYcBGKaQYjJViaJideo917n29WAH2 KTDQZS8w+fQWhjH+OBWgo89H8o7eaew= X-MC-Unique: opDnOLvZNqyRnN7VSCr8YQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] remote: Avoid leaking uri_out Date: Thu, 26 Jan 2023 11:29:23 +0100 Message-Id: <29acf782a7d677e6fe0b9d6de0f883136a87fa6c.1674728899.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674728984998100001 Content-Type: text/plain; charset="utf-8" In case the API returned success and a NULL pointer in uri_out, we would leak the preallocated buffer used for storing the uri_out pointer. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/remote/remote_daemon_dispatch.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index dbe6825fb8..6cf88e22c3 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -3061,15 +3061,14 @@ remoteDispatchDomainMigratePrepare2(virNetServer *s= erver G_GNUC_UNUSED, */ ret->cookie.cookie_len =3D cookielen; ret->cookie.cookie_val =3D cookie; - ret->uri_out =3D *uri_out =3D=3D NULL ? NULL : uri_out; + ret->uri_out =3D *uri_out =3D=3D NULL ? NULL : g_steal_pointer(&uri_ou= t); =20 rv =3D 0; =20 cleanup: - if (rv < 0) { + if (rv < 0) virNetMessageSaveError(rerr); - VIR_FREE(uri_out); - } + VIR_FREE(uri_out); return rv; } =20 @@ -4776,15 +4775,14 @@ remoteDispatchDomainMigratePrepare3(virNetServer *s= erver G_GNUC_UNUSED, */ ret->cookie_out.cookie_out_len =3D cookieoutlen; ret->cookie_out.cookie_out_val =3D cookieout; - ret->uri_out =3D *uri_out =3D=3D NULL ? NULL : uri_out; + ret->uri_out =3D *uri_out =3D=3D NULL ? NULL : g_steal_pointer(&uri_ou= t); =20 rv =3D 0; =20 cleanup: - if (rv < 0) { + if (rv < 0) virNetMessageSaveError(rerr); - VIR_FREE(uri_out); - } + VIR_FREE(uri_out); return rv; } =20 @@ -5572,16 +5570,15 @@ remoteDispatchDomainMigratePrepare3Params(virNetSer= ver *server G_GNUC_UNUSED, =20 ret->cookie_out.cookie_out_len =3D cookieoutlen; ret->cookie_out.cookie_out_val =3D cookieout; - ret->uri_out =3D !*uri_out ? NULL : uri_out; + ret->uri_out =3D !*uri_out ? NULL : g_steal_pointer(&uri_out); =20 rv =3D 0; =20 cleanup: virTypedParamsFree(params, nparams); - if (rv < 0) { + if (rv < 0) virNetMessageSaveError(rerr); - VIR_FREE(uri_out); - } + VIR_FREE(uri_out); return rv; } =20 --=20 2.39.1 From nobody Sun May 19 06:23:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674728991; cv=none; d=zohomail.com; s=zohoarc; b=dbCL+zh5xizq2U0gVFNenvm2sTskVWTBsC2LMIW7QDaQcQobOigsU5fBKeg9/M/7vIO8htctU9CB/UZsp3le2xEGNSsoAh/jVkQXVmmgl7VMqRN6P7W4RkLyB7vzl7lSAS8NnhKxbi6h0Zhf6enkg6U5ag24tCYXHsV6hKwByag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674728991; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZCXNvx90lof1bDI9v0hG9JxSiGM6yUay7WF3SixwPE4=; b=jIwOnP53YO3Wl3/JNcDtSreaU5YvaPaZPstwlLUT3i+D0pyXK0QHKhzh/PQg/cgJE625bar5v4HZk1FgT/xSoe9MIHf4dgc5b3z9s3Ugs3oe79oqGVUufuC3K+cgO4KJxdcW30kfR4fc5TKkW4t5b3HtemTiiJIsaz2vLnX3j8I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1674728991674224.84834807045524; Thu, 26 Jan 2023 02:29:51 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-502-11Jpq_C8NxG9PVQOS5eQgA-1; Thu, 26 Jan 2023 05:29:40 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ABDBB1C075BA; Thu, 26 Jan 2023 10:29:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95CD814171C4; Thu, 26 Jan 2023 10:29:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4969B19465A8; Thu, 26 Jan 2023 10:29:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BC7FA1946594 for ; Thu, 26 Jan 2023 10:29:30 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 853201121333; Thu, 26 Jan 2023 10:29:30 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47D201121330 for ; Thu, 26 Jan 2023 10:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674728990; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ZCXNvx90lof1bDI9v0hG9JxSiGM6yUay7WF3SixwPE4=; b=FGedhgYfooLRNu4/xLn0PfHpA5IR3G/fge/z7LwvoFqvMoMJrZXig1fUyOoDn9a4/hGTR8 lEUGig+6OxIBrtZhd/wjalo8j7R9kUA5ATaHHjsQoCPu+4n51qXXPzzOKqqLPr2v6P3q0E Qxt7+yG8J36GuqBYppDMGcAD5LxzVa0= X-MC-Unique: 11Jpq_C8NxG9PVQOS5eQgA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] remote: Drop useless cleanup in remoteDispatchNodeGet{CPU, Memory}Stats Date: Thu, 26 Jan 2023 11:29:24 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674728993020100001 Content-Type: text/plain; charset="utf-8" The function cannot fail once it starts populating ret->params.params_val[i].field. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/remote/remote_daemon_dispatch.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 6cf88e22c3..16bb23f049 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -3309,11 +3309,6 @@ remoteDispatchNodeGetCPUStats(virNetServer *server G= _GNUC_UNUSED, cleanup: if (rv < 0) { virNetMessageSaveError(rerr); - if (ret->params.params_val) { - for (i =3D 0; i < nparams; i++) - VIR_FREE(ret->params.params_val[i].field); - VIR_FREE(ret->params.params_val); - } } VIR_FREE(params); return rv; @@ -3376,11 +3371,6 @@ remoteDispatchNodeGetMemoryStats(virNetServer *serve= r G_GNUC_UNUSED, cleanup: if (rv < 0) { virNetMessageSaveError(rerr); - if (ret->params.params_val) { - for (i =3D 0; i < nparams; i++) - VIR_FREE(ret->params.params_val[i].field); - VIR_FREE(ret->params.params_val); - } } VIR_FREE(params); return rv; --=20 2.39.1