From nobody Mon Feb 9 00:30:44 2026 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=1681309525; cv=none; d=zohomail.com; s=zohoarc; b=baWq2Mj43BEb6jHAtm769QFqMcQsC6gDlJMJxlhkdSbY4jPuHbk8MKGhJkrlfpdhHiIKlN5xYC1Ms8OMFEDYGnmZXh+VtFGTraKuoV0DWq/4kuKdYD664BU6ymyFfFr4vNddGs20Ty6hoekAbNmqWQZjasWuuo4U8RGgNX9Ozts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681309525; 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=s/HapDv5NRmuZPKBXRwFqq+MkXya+ZDPUndSvCyxFQM=; b=cRqczavZpUOr7eQhnBrKbBRyVEItY/uhB0IUwNjXTuq5O3/6pfUIcnzFu2lwDg7JMQIsTvyMvifRWj2b3+CRkoq+dHNaK1LwCAO5DbnQEqBNgZz0XUXJE46m1IQWfyni1eJXxFoZErSwRIRO8wNiHfd8yZjXYq6Ojs88uMO07vw= 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 168130952589920.775091021565117; Wed, 12 Apr 2023 07:25:25 -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-519-6H-nHQgeN324w2gNAp-NAg-1; Wed, 12 Apr 2023 10:25: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 8EF7F3C025D0; Wed, 12 Apr 2023 14:25:16 +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 788C114171B6; Wed, 12 Apr 2023 14:25:16 +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 5E8B8194658F; Wed, 12 Apr 2023 14:25:16 +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 E0C0D194658F for ; Wed, 12 Apr 2023 14:25:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D2D6D2027044; Wed, 12 Apr 2023 14:25:13 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 732902027043 for ; Wed, 12 Apr 2023 14:25:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681309524; 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=s/HapDv5NRmuZPKBXRwFqq+MkXya+ZDPUndSvCyxFQM=; b=MbeDaFP5LsdOmBhAvIZhJSBU5hpM4i8MP3S4M0OEyBTp/w3R7Pnye4JxqWPwOKvmJW860z Xmu8MZ1hfNPN6F98m5Xq9lYmPLPt5vsid/UPcP2gNfEStuN+K5zQyE0H7ntwvqkTbNFhph HJkhJw4EFiorrwxPijWwuepmsnmCPTM= X-MC-Unique: 6H-nHQgeN324w2gNAp-NAg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/5] qemuDomainChrRemove: Don't leak vmdef->consoles[0] Date: Wed, 12 Apr 2023 16:25:07 +0200 Message-Id: <31b29272dc4ce06c17848a472935cac5863d1aa3.1681307447.git.mprivozn@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.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: 1681309527611100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When removing the compat console from domain defintion, removing it from the vmdef->consoles array is good, but not sufficient. The console definition might have been fully allocated (after daemon restarted and reloaded the status XML). Use virDomainChrDefFree() to free also the definition. Signed-off-by: Michal Privoznik --- src/qemu/qemu_hotplug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f517646c55..a6407f074b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1937,8 +1937,10 @@ qemuDomainChrRemove(virDomainDef *vmdef, return NULL; } =20 - if (removeCompat) + if (removeCompat) { + virDomainChrDefFree(vmdef->consoles[0]); VIR_DELETE_ELEMENT(vmdef->consoles, 0, vmdef->nconsoles); + } =20 return ret; } --=20 2.39.2