From nobody Sun Feb 8 23:05:38 2026 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=1652865783; cv=none; d=zohomail.com; s=zohoarc; b=Ni3MfJGcoh2o2WaEH0njSYFQjlSZ/36RBdUYOBNDw6Y1HRnzCTb+M6fOPNOrz5TK9XGvWDW2V8PRx0vEQuYH/13VsQ0I4F5qJlhLbVdkhK01domsLitv/rD+AsDFg+2NTYhbtJ+i/OH9Od6cbfg/FP04kqbuk5GQYsb5iKgsV4A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652865783; 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=qfX3kmJ6IhpP7Z08bbAQKU/5OMAqzdWOpPamfhMD+sA=; b=UOJpI60WYtZFUcU6SueAxW0FP5puAOvLXhhD1qJOT/EA2735XMARpfbc1aaGxZkC6tkkbfSvybIxVbclrKjg1Ueh+wDsILf5BSd2xrZ1z38PxQqVIfxOBa5OdMVrgRJb3HQwbXU4XSfiY30NrmQae05xxhS8rGK48zMLnlDFx1o= 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 16528657838471010.345420860127; Wed, 18 May 2022 02:23:03 -0700 (PDT) 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-58-DxXh8lGwNvu03KpQ0gS-IQ-1; Wed, 18 May 2022 05:22:21 -0400 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 849E91C08968; Wed, 18 May 2022 09:22:19 +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 A362A1400E75; Wed, 18 May 2022 09:22:18 +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 5697E1947B92; Wed, 18 May 2022 09:22:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CA8A21947B84 for ; Wed, 18 May 2022 09:22:16 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BB4B740CF8F0; Wed, 18 May 2022 09:22:16 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FCE640CF8EE for ; Wed, 18 May 2022 09:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652865782; 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=qfX3kmJ6IhpP7Z08bbAQKU/5OMAqzdWOpPamfhMD+sA=; b=bD86yRoqGENqAtZ7QnJ0LzNiXCkj1xJi9v2bjTZj/iwHhwjW9OPMC+Tkwe14rulPVjmYwe pF8HHVQ1mnkfCEkDE5gJMlJvDtrVYvP3EbfuNFjCeWySoDMfpJFc6HqXebGO3N9g70rxl5 azZcwxpO/4BAEQhs1EBfdCeroyvX5y8= X-MC-Unique: DxXh8lGwNvu03KpQ0gS-IQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/4] virGetConnectGeneric: Fix memleak of 'identparams' when connecting between split daemons Date: Wed, 18 May 2022 11:22:11 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652865784955100002 Content-Type: text/plain; charset="utf-8" The 'identparams' typed parameter list obtained from virIdentityGetParameters is leaked when called from 'virGetConnectGeneric'. Use 'virTypedParamListFromParams' to absorb it into a virTypedParamList which can be autofreed. Note that the memleak is observable only when running in split-daemon mode. Closes: https://gitlab.com/libvirt/libvirt/-/issues/314 Signed-off-by: Peter Krempa --- src/driver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/driver.c b/src/driver.c index 41b4f0055b..d4136c438f 100644 --- a/src/driver.c +++ b/src/driver.c @@ -36,6 +36,7 @@ #include "viridentity.h" #include "datatypes.h" #include "configmake.h" +#include "virtypedparam.h" VIR_LOG_INIT("driver"); @@ -159,6 +160,7 @@ virGetConnectGeneric(virThreadLocal *threadPtr, const c= har *name) if (conn->driver->connectSetIdentity !=3D NULL) { g_autoptr(virIdentity) ident =3D NULL; + g_autoptr(virTypedParamList) paramlist =3D NULL; virTypedParameterPtr identparams =3D NULL; int nidentparams =3D 0; @@ -169,7 +171,9 @@ virGetConnectGeneric(virThreadLocal *threadPtr, const c= har *name) if (virIdentityGetParameters(ident, &identparams, &nidentparam= s) < 0) goto error; - if (virConnectSetIdentity(conn, identparams, nidentparams, 0) = < 0) + paramlist =3D virTypedParamListFromParams(&identparams, nident= params); + + if (virConnectSetIdentity(conn, paramlist->par, paramlist->npa= r, 0) < 0) goto error; } } --=20 2.35.3