From nobody Mon Nov 23 04:30:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1795346580; cv=none; d=zohomail.com; s=zohoarc; b=UUEy6ul3HWLcTlgbcCb/D+N/3ysn8uYlLRTSSLMY8bmdulJ6vOHj3UlCtXd1plkd+BNX8pIUaXblCAPkyPoO0hjH4k95EkAdyOkUn4FqSAtPPqFCR0r764OGA24JxKpL5oYvNET7W+AupziHXSgLsoG2ZjjZcuEcAsi08goi6rQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795346580; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6Piiuo3L9loEVIaKH0H90X1sFByguw0+gC/qDB7xB44=; b=UiT+5tJ3OIr/fv2jy4wIK/5pwz2uDMUkEVX98MiNJJCtGWB6XqSk3cR/nxxtgBZ2oMW0J6t/iC1ahvmewR9GulJUGcDuog+9qVYt+9bOTSlAD5AiyivPkPZeEkgZvsAoGhr6smPgxoFFUtPK7+e6ABmQ9MngYqTS9GnIXH/01/Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795346580260962.3751407507345; Sun, 22 Nov 2026 03:23:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xV5eT-00060h-9U; Sun, 22 Nov 2026 06:22:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xV5eL-0005oF-CD for qemu-devel@nongnu.org; Sun, 22 Nov 2026 06:22:26 -0500 Received: from mail-pj2-x09.google.com ([2607:f8b0:4864:39::9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xV5eI-00039q-PS for qemu-devel@nongnu.org; Sun, 22 Nov 2026 06:22:24 -0500 Received: by mail-pj2-x09.google.com with SMTP id 98e67ed59e1d1-3b3fa8df5c4so1273118a91.0 for ; Sun, 22 Nov 2026 03:22:22 -0800 (PST) Received: from ubuntu.. ([103.49.135.232]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b44b704cfesm3573820a91.1.2026.11.22.03.22.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2026 03:22:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795346541; x=1795951341; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=6Piiuo3L9loEVIaKH0H90X1sFByguw0+gC/qDB7xB44=; b=M9AIzRQRRqw5WI7NeyYb2R2vXMjBnvTxzoyV7MngcezAzhzPbHEaOhsO1V8YR1hD4K LsMgaS2VHk5mn0M+VbvbY11PIM5IMW4xC8E7WOqao49oFH9aSDe2qET4mfjrW9TvlUFW Qwb+uVvPuZX38Gx+JoR4YULIW4Br9IyN0gmEbbB6VKcCY2ZwZ3n7XBrTWgm3J8PczZBX kQwiJe9qwdH1b4+Dhq8OIGylvbUSH5NssB3VDT4QItKtWAQSmaGKjGEUEn6KBsRYre4E VoNwHyi7UGBNggHMY6Cy5UFsMic4iz6UUbnT0+g0FvX39peHjgRRqUdXzI2aYDJaAzuR OsUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795346541; x=1795951341; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=6Piiuo3L9loEVIaKH0H90X1sFByguw0+gC/qDB7xB44=; b=nZJw7tEKeImFEz5OHRUlYqcfA2dqHiPrM+oCkik0zTGOoEdpY00de+F9fNK8Kvrodc qslXVZAV8pQ0wb3n182JtKxa+Kgr9wd+EXaGuzy7FSo9CpvfLYobMvQTA3AlkE4Slrif a1d4+isLz0ddXgB3ZopmDrK0tyXLav4rFKUfNxBGLp/BEbc2C0I9rVhkzyXXFZS651T7 0tUQyZ6tlOaVewjr+NwPZDMy0vByLIRX4DXrubP8DvQ8s0c80anOmPgDHsWnhnveg8VY KJxqqB0vUeekgxWBoj0hBHwUkOQZKEce5KViITsPQX3sxk2S0fhyLkKoN4e7goqsQEO3 Gkpw== X-Gm-Message-State: APuU4Z8qEU3xTd1iP2MqGfGI+jQCr51KSwnZST+Jtx+yUYlXxO3hranO Z+HdbXRd5XfOFwxYSCLQ+lhizT3cfyxYYHgO0aloNcQTyl4WZMUMJ8tE5cacneDrOqg= X-Gm-Gg: AZFdTZelugETtQq8joinNh+eCbUc/d1s0c03AV0OPSEaGOb0CwmzDZScleQ9HFlScfF /EMy1LjObmrMURqzTU8i4PLdVGK2BneI0+YMqKOCWo5wR5GOMhvFq25KWyQF4mKAup1L22JZqec ILWYlx5C0hnMy6kTdfnVSdWGYPuMDkVyLHiqXFuLDPh/qtDaQOJpLgEz2Srt5sHy4MtBMWoqwqb ThjHAM5bAlT+eK/cTN1rH0HLyoflaIifhb07qwqt+BNoYdCaJbQEGPdeSe+4SSIta3OKJz2nJc5 b312TaptyJAVRp+Wr5kwqK6+ILvjZ1nXwsNsis5xDeq68frJNOlgQFp8zYshYj0AWpHciGwj95c aUYZo8sanvp94tXmz4QGZdd19svIgX6I3hKTLIPU0mJV1QsCBFRptSmQM8fnMGaVsjI1+yN7W5w 8/RYFoFt47QOgUc/z+4BWEnmFoHq24IWnGeRu2A2VYf8nKX8t80a9XYO2RdIEwtudLk2C/Bjo92 QyR2BYYjg4wBFsagc+6Bxl22FybNWRFmbbq0A3RJ4SOrui9JwQS8YUKs8vUnFkuj9IgW+06WOMh A1YGLjmXFkWv/76XzeqqnikpweY= X-Received: by 2002:a17:90b:4ec4:b0:3ac:adce:60be with SMTP id 98e67ed59e1d1-3b41c8fe3b0mr8100043a91.21.1795346541285; Sun, 22 Nov 2026 03:22:21 -0800 (PST) From: Zhu Wei X-Google-Original-From: Zhu Wei To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , niming , zhuwei , "zachwade . k" Subject: [PATCH 1/1] ui: fix QEMUCursor leak in qemu_graphic_console_finalize() Date: Sun, 22 Nov 2026 19:22:13 +0800 Message-ID: <20261122112213.1645993-2-zhuwei@sangfor.com.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261122112213.1645993-1-zhuwei@sangfor.com.cn> References: <20261122112213.1645993-1-zhuwei@sangfor.com.cn> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:39::9; envelope-from=zachwade.k@gmail.com; helo=mail-pj2-x09.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1795346582278048801 Content-Type: text/plain; charset="utf-8" From: zhuwei qemu_console_set_cursor() stores the cursor in QemuGraphicConsole.cursor with a reference taken by cursor_ref(). qemu_graphic_console_finalize() only drops the reference on c->device, so the reference held by c->cursor is never released. As a result the reference count of the QEMUCursor, and the pixel data it owns, never reach zero when the console is finalized, leaking both. Release the reference in qemu_graphic_console_finalize() with g_clear_pointer(&c->cursor, cursor_unref), which is the same pattern already used for the spice display cursor. Fixes: 385ac97f8fad ("ui: keep current cursor with QemuConsole") Signed-off-by: niming Signed-off-by: zhuwei --- ui/console.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/console.c b/ui/console.c index c995abc5d1..327bbc4a5c 100644 --- a/ui/console.c +++ b/ui/console.c @@ -469,6 +469,9 @@ qemu_graphic_console_finalize(Object *obj) QemuGraphicConsole *c =3D QEMU_GRAPHIC_CONSOLE(obj); =20 g_clear_pointer(&c->device, object_unref); + + /* Release the reference taken by qemu_console_set_cursor() */ + g_clear_pointer(&c->cursor, cursor_unref); } =20 static void --=20 2.56.0