From nobody Mon Feb 9 23:01:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517859478587821.6553319806452; Mon, 5 Feb 2018 11:37:58 -0800 (PST) Received: from localhost ([::1]:54804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eimaQ-0003Yr-U8 for importer@patchew.org; Mon, 05 Feb 2018 14:37:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eimS8-0004KJ-6k for qemu-devel@nongnu.org; Mon, 05 Feb 2018 14:29:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eimS6-0004ud-Je for qemu-devel@nongnu.org; Mon, 05 Feb 2018 14:29:20 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:40437) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eimS6-0004uJ-D4 for qemu-devel@nongnu.org; Mon, 05 Feb 2018 14:29:18 -0500 Received: by mail-wm0-x242.google.com with SMTP id v123so28068425wmd.5 for ; Mon, 05 Feb 2018 11:29:18 -0800 (PST) Received: from 640k.lan ([82.84.122.246]) by smtp.gmail.com with ESMTPSA id g8sm20029891wra.18.2018.02.05.11.29.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2018 11:29:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=XlkV6N9xu9Upoqu8seXCsK4k/H1VD/V9qi0GW6vkK54=; b=ao9Eu2epmJTZWuvhXqhUcZGhB7D+TbwKZjGcL5Tk0scxwGOWIkvUkegD9ndDLZO4qg QYq3ZXj//ZM4pD+M+hFEvMT3z29EWNZnoXesB3LpLNwArb9tjn/Y+ALj4056uQ+TZYx3 0Hpsqw4TqcMnH9YnXl7TCp8cMd3DeQ4DRVfvn/ByqBesjIIO9/If3sP7/LSGwYwlP2fe mce3gHxy1yu5kPKjIuP6XZDqhAkonJKcyeZ5oOgX41qJVzz0SPb2wtNmzH4LbYRfG6Qt 187nqRM2axhtihYGij5XO185u+Db8WrPd66HSnQgq9vaBW+fm1vxHBpe5Gx2eKgeEpVe YI2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=XlkV6N9xu9Upoqu8seXCsK4k/H1VD/V9qi0GW6vkK54=; b=rZZ5Ag34rKeQAPSrMxdKe7N3XqV9t+aKETCsOd5LXneY7NpAPabYLEgfVr+VSgjJlS YCNBZIHaTikss9P2Vn9DGh8QlOdvpYO9dM06H62JCLwjM1sYypvv40RMbyM3kUy6Idoc miFDrYZJwhj/FumtQZmXLCCNSmHM0wcOyuIoGywBMYZsdw2GZmDzvHmkIzbCV76mwr4N pFhvhOBu61NfwpqzMwYpRZ+TZ22tfvu6FgPjqJQhbn1OxW83qeB/nL/STYVClZebL8zN +t9wGsGEQ/TtMC+mefPaNc6SBL0b5gKlCExNS3Ta06ERim550FLdU/SQ9C6KbF8sIq4b TWng== X-Gm-Message-State: APf1xPAfX5TOiI8epL6aYVou4wWWkBC5M1W21XBjn+QsEBavUisxkvCp WzbJm2D18h6VM5pjNv40VVezVIwf X-Google-Smtp-Source: AH8x226LyLFpTxsHkw8hML4u3oV8M13VTu7tvI7Sn5OLL0OwU6DFyW06UMC/aHfKI657B2vy3hdSlA== X-Received: by 10.28.85.194 with SMTP id j185mr290285wmb.31.1517858956978; Mon, 05 Feb 2018 11:29:16 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 5 Feb 2018 20:28:24 +0100 Message-Id: <1517858941-5538-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517858941-5538-1-git-send-email-pbonzini@redhat.com> References: <1517858941-5538-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 10/47] readline: don't free completions in readline_free() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz Since commit e5dc1a6c6c43, QEMU aborts on exit if completion was used in the monitor: *** Error in `obj/ppc64-softmmu/qemu-system-ppc64': double free or corruption (fasttop): 0x00000100331069d0 *** /home/greg/Work/qemu/qemu-spapr/util/readline.c:514 /home/greg/Work/qemu/qemu-spapr/monitor.c:586 /home/greg/Work/qemu/qemu-spapr/monitor.c:4125 argv=3D, envp=3D) at /home/greg/Work/qemu/qemu-spapr/vl.c:4795 Completion strings are not persistent accross completions (why would they?). They are allocated under readline_completion(), which already takes care of freeing them before returning. Maybe all completion related bits should be moved out of ReadLineState to a dedicated structure ? In the meantime, let's drop the offending lines from readline_free() to fix the crash. Signed-off-by: Greg Kurz Message-Id: <151627206353.4505.4602428849861610759.stgit@bahia.lan> Fixes: e5dc1a6c6c43 Signed-off-by: Paolo Bonzini --- util/readline.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/util/readline.c b/util/readline.c index 24ec839..ec91ee0 100644 --- a/util/readline.c +++ b/util/readline.c @@ -510,9 +510,6 @@ void readline_free(ReadLineState *rs) for (i =3D 0; i < READLINE_MAX_CMDS; i++) { g_free(rs->history[i]); } - for (i =3D 0; i < READLINE_MAX_COMPLETIONS; i++) { - g_free(rs->completions[i]); - } g_free(rs); } =20 --=20 1.8.3.1