From unknown Wed Jun 18 22:57:53 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#62823 <62823@debbugs.gnu.org> To: bug#62823 <62823@debbugs.gnu.org> Subject: Status: 29.0.60; Fixing a small leak in tree-sitter search functions Reply-To: bug#62823 <62823@debbugs.gnu.org> Date: Thu, 19 Jun 2025 05:57:53 +0000 retitle 62823 29.0.60; Fixing a small leak in tree-sitter search functions reassign 62823 emacs submitter 62823 Yuan Fu severity 62823 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 13 18:49:04 2023 Received: (at submit) by debbugs.gnu.org; 13 Apr 2023 22:49:04 +0000 Received: from localhost ([127.0.0.1]:44997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pn5kV-0005ry-O2 for submit@debbugs.gnu.org; Thu, 13 Apr 2023 18:49:04 -0400 Received: from lists.gnu.org ([209.51.188.17]:50394) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pn5kR-0005rW-Vs for submit@debbugs.gnu.org; Thu, 13 Apr 2023 18:49:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pn5kR-0001ZF-HB for bug-gnu-emacs@gnu.org; Thu, 13 Apr 2023 18:48:59 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pn5kP-0004Jx-HC for bug-gnu-emacs@gnu.org; Thu, 13 Apr 2023 18:48:59 -0400 Received: by mail-pj1-x1033.google.com with SMTP id c10-20020a17090abf0a00b0023d1bbd9f9eso19905381pjs.0 for ; Thu, 13 Apr 2023 15:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681426136; x=1684018136; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=nEgMbhPg+HzK/CqiV+cqrkNT3Kn6+5w4t//55uxNeIA=; b=AzrHHKc/VGkhi9oF31CtsulqX6sNfxtzV1hGwk04/If0XOx5QyMNdviBqtcBYmi4Gl VYDZJ0CeAKHi9Fq0HfkzOJ+/uIgUkaSKso/cphx8DgUxh6My2NrAe3vlC3Ed2P1bCL+4 FtNnf1olQgEmlwutL358QYm7o/aIt6r94HBTQbdpfuvwCSnUL+kLh3ZTPz5gPM2RSn87 UfSwgoBPsZGHhl6UANO251j1dXcTbh7axDZElL47m4o+LNccSLI3oYBnvdAcKjGKHVuv zERU73KbZW86FNPmBQQP2QQPd6Rt+QEV68v5ML20QBEYyeWWaJ87bFbWSyBcVYHOnO3l DvWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681426136; x=1684018136; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nEgMbhPg+HzK/CqiV+cqrkNT3Kn6+5w4t//55uxNeIA=; b=aVUVmEZ9IaXYbx9RcYMSVwGo+HgYXiWZib68oFEV9cvjrRWRoxZlk0CSpF1VLQVXDV jbwYKT/f0DZhWnjyXBixaorBH70bfCkM4YZHPJknQEhfIHrbkZ8qT8cXohUc8H6nNfl+ Bw3gGw3i0V10OQ5g0Y9v7YuPxyDabyWt0YSfJW7a9z3c9f9Jzl2NxSpz03PdML/wK/hO tZCZs06TO+ycVMUWpcya1h1aO9TYjaNqjYhwDIeDA2SgzNg/2uHUmklkaMFqqEV9+M+O Hp+VnNNTXIUo1cnpbynslNd9SCI99+8f3eeUGB7AVNUKt3b64uiIpHtHwByZd5Wdt4ct G8pQ== X-Gm-Message-State: AAQBX9dMboQ2PqygfRNuFSRafzhC2X8AjBvOnK+QLhJQ86h7Gp57nnG5 ScHjzGxktPaSOEkh7NDc59yH4jO5jbHZkQ== X-Google-Smtp-Source: AKy350Ype2p4qAJMxmZ0tW8N9BnaDh3G7jSQwK4VM1x5vBcDgQ/21VC5kbqBCvcZ7gISPJd6IIG3GA== X-Received: by 2002:a17:902:82c9:b0:1a5:19d1:f904 with SMTP id u9-20020a17090282c900b001a519d1f904mr492955plz.43.1681426135420; Thu, 13 Apr 2023 15:48:55 -0700 (PDT) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id t20-20020a170902d21400b001a05122b562sm1920600ply.286.2023.04.13.15.48.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Apr 2023 15:48:54 -0700 (PDT) From: Yuan Fu Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) Subject: 29.0.60; Fixing a small leak in tree-sitter search functions Message-Id: Date: Thu, 13 Apr 2023 15:48:43 -0700 To: Bug Report Emacs X-Mailer: Apple Mail (2.3731.500.231) Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=casouri@gmail.com; helo=mail-pj1-x1033.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-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) When we switch to using cursors instead of nodes [1] in treesit.c for search functions, we introduced a small leak: the search functions allows the user to pass a predicate function, which can signal. And because we are now using cursors, which needs to be freed, everytime the predicate function signals, the cursor is leaked. I pushed a fix to master (a5eb9f6ad4e), the change is relatively straightforward so I hope we can pick it into the next pretest. And sorry for introducing the leak in the first place :-( Yuan [1] Commit e492c21e81040b9539139b78f6baf98df17bbaab (bug#60267) Below is the fix: commit a5eb9f6ad4e6f5a2819b540a477f1e889f6ef355 Author: Yuan Fu Date: Thu Apr 13 14:36:46 2023 -0700 Catch signals produced by PRED in tree-sitter search functions Earlier we switched to using cursors rather than nodes to traverse the parse tree. Because cursors need cleanup, we have to catch signals thrown by the predicate functions and free the cursor. Failing to do this will result in leaking the cursor whenever the predicate function signals in a search function. This change fixes the leak. * src/treesit.c (treesit_traverse_cleanup_cursor): New function. (Ftreesit_search_subtree) (Ftreesit_search_forward) (Ftreesit_induce_sparse_tree): Catch signals. diff --git a/src/treesit.c b/src/treesit.c index fd5fda78133..76d1dc8ccf4 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -3247,6 +3247,12 @@ treesit_search_forward (TSTreeCursor *cursor, } } +/** Cleanup function for cursor. */ +static void treesit_traverse_cleanup_cursor(void *cursor) +{ + ts_tree_cursor_delete ((TSTreeCursor *) cursor); +} + DEFUN ("treesit-search-subtree", Ftreesit_search_subtree, Streesit_search_subtree, 2, 5, 0, @@ -3288,12 +3294,18 @@ DEFUN ("treesit-search-subtree", if (!treesit_cursor_helper (&cursor, XTS_NODE (node)->node, parser)) return return_value; + specpdl_ref count = SPECPDL_INDEX (); + record_unwind_protect_ptr (treesit_traverse_cleanup_cursor, &cursor); + if (treesit_search_dfs (&cursor, predicate, parser, NILP (backward), NILP (all), the_limit, false)) { TSNode node = ts_tree_cursor_current_node (&cursor); return_value = make_treesit_node (parser, node); } + + unbind_to (count, Qnil); + ts_tree_cursor_delete (&cursor); return return_value; } @@ -3345,12 +3357,18 @@ DEFUN ("treesit-search-forward", if (!treesit_cursor_helper (&cursor, XTS_NODE (start)->node, parser)) return return_value; + specpdl_ref count = SPECPDL_INDEX (); + record_unwind_protect_ptr (treesit_traverse_cleanup_cursor, &cursor); + if (treesit_search_forward (&cursor, predicate, parser, NILP (backward), NILP (all))) { TSNode node = ts_tree_cursor_current_node (&cursor); return_value = make_treesit_node (parser, node); } + + unbind_to (count, Qnil); + ts_tree_cursor_delete (&cursor); return return_value; } @@ -3467,8 +3485,14 @@ DEFUN ("treesit-induce-sparse-tree", to use treesit_cursor_helper. */ TSTreeCursor cursor = ts_tree_cursor_new (XTS_NODE (root)->node); + specpdl_ref count = SPECPDL_INDEX (); + record_unwind_protect_ptr (treesit_traverse_cleanup_cursor, &cursor); + treesit_build_sparse_tree (&cursor, parent, predicate, process_fn, the_limit, parser); + + unbind_to (count, Qnil); + ts_tree_cursor_delete (&cursor); Fsetcdr (parent, Fnreverse (Fcdr (parent))); if (NILP (Fcdr (parent))) From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 14 02:46:10 2023 Received: (at 62823) by debbugs.gnu.org; 14 Apr 2023 06:46:10 +0000 Received: from localhost ([127.0.0.1]:45302 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnDCE-0002hS-Dy for submit@debbugs.gnu.org; Fri, 14 Apr 2023 02:46:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnDCD-0002hG-8N for 62823@debbugs.gnu.org; Fri, 14 Apr 2023 02:46:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pnDC6-00036M-Gu; Fri, 14 Apr 2023 02:46:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=RevooRCZxfqs8YKQMrGIu1+vtjXZKUgAwkMbPCJMu2k=; b=DBuVlBS73fzh aKYNFxEuNREMWb6nfWd8wXhaAEfZ9Th8mFhw2yhpX+BxOKpiyBqK/fdyEwZvVRnYXTqzKePNhnCB6 Q/eu9UM/GyJXE1nFRjX2SASx8uBdUVGhGngZoRHxlsFS5/zGsQMZq6Um83HAVkSxHbtXrEX2Hf0GF Q4n2pcTy4uOInIjw99szcFY4EPU9bg8wT8X1nWvjgOha7wX/sUzSz8Y+EybaTpD8w2OgVx1FfjcbU /+V4fdcyDnxVz+y4AMsaXXbKOs/WMhlTW+LseMXAwi9PJhWceBC8qTV8uFnt+D2GJu+WfKGMdqWJL MJXxQIPYXMYk8pfsNkM9dw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pnDBv-0007gl-RW; Fri, 14 Apr 2023 02:46:00 -0400 Date: Fri, 14 Apr 2023 09:45:47 +0300 Message-Id: <83zg7bezc4.fsf@gnu.org> From: Eli Zaretskii To: Yuan Fu In-Reply-To: (message from Yuan Fu on Thu, 13 Apr 2023 15:48:43 -0700) Subject: Re: bug#62823: 29.0.60; Fixing a small leak in tree-sitter search functions References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62823 Cc: 62823@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Thu, 13 Apr 2023 15:48:43 -0700 > > When we switch to using cursors instead of nodes [1] in treesit.c for > search functions, we introduced a small leak: the search functions > allows the user to pass a predicate function, which can signal. And > because we are now using cursors, which needs to be freed, everytime the > predicate function signals, the cursor is leaked. > > I pushed a fix to master (a5eb9f6ad4e), the change is relatively > straightforward so I hope we can pick it into the next pretest. Thanks, but this kind of bugs should be fixed on the release branch to begin with (I've backported it now). If you are unsure on which branch to install such changes, please ask before installing. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 14 14:27:43 2023 Received: (at 62823) by debbugs.gnu.org; 14 Apr 2023 18:27:43 +0000 Received: from localhost ([127.0.0.1]:47602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnO99-0006G5-9n for submit@debbugs.gnu.org; Fri, 14 Apr 2023 14:27:43 -0400 Received: from mail-pl1-f176.google.com ([209.85.214.176]:35366) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnO97-0006Fr-IY for 62823@debbugs.gnu.org; Fri, 14 Apr 2023 14:27:41 -0400 Received: by mail-pl1-f176.google.com with SMTP id y6so18070869plp.2 for <62823@debbugs.gnu.org>; Fri, 14 Apr 2023 11:27:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681496855; x=1684088855; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QW8SO/JTHoMZi3Khnr7heoxcbdvtPDP/WyWGwi884KY=; b=fau9ks+COsOzz2mnNu2R0qHWrPIjXbl//t05PTmdYYkPtdqXWn/C3YlMBw1wOkaBaX k9b77tqoUwrBlbP1G+K9DyE2rTA4dROsLKGr2V0N4FIyBv8HveEHG6hOBufk1R19Xgzq 9LBZTjGNio1PHQBd4hZ2M16mZL8IxBOBCPFiltKc/U9KK2s9Th3p9w3J2oGlUJOYU6bs UKX/0MwWiYAEy1SWBEEc2hfKHxqpCB0kB6wa1C7u5ykDLS4ydpHUYqW/HsP0wtWdvuCY 4i2kMVuCXotyaYAYzmE9XEubbTbp17mrkkdSM+tGODLRgervo27dl+iCnp2fFoow6N9s PdLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681496855; x=1684088855; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QW8SO/JTHoMZi3Khnr7heoxcbdvtPDP/WyWGwi884KY=; b=EmbyV1/cNHANRFnGQSd8ltVkVkvyt3gENYCRM3TGmulOmVQeJ8C3/dtXXf5bgXPWKJ vYhrQPtxkHdGSUnGl/kLRUipWJXyEuMH6M9ezcYX3xh57/ggajfTA9CkIIm1HZhC6fvB CkreA+BUmvz+ym2zSZirtAmtot7dT+FO+gQuWazYDRJkC1YcWFAfwoITe7KWHD5GMpkW v1Y8vKOwVRysPj2iYwKFFntOqX6rg5zw0L6dGZ5Crdba7/kL2qTtdlfY5Lfvu4IgcuoS lsJVfPp1gVAUfA+7UNqGgZ9aDb0ZimuxpVpowi9iQE0Wh/653LcSok9SnHhEamInI08d j8pw== X-Gm-Message-State: AAQBX9e+8K2/wAfZL6j/0rY0Bka086+ps+9QVclYL2qIq5CpePedQFUC 6suT2pyiBuUrzAQ+f6Uc9Dc= X-Google-Smtp-Source: AKy350beU6577oxGy/sPWhArBuBaNHshJFMmZELiY1Lfep6Mu3sBpbyhlIWGzNy60qovQcwdWKxr5g== X-Received: by 2002:a05:6a20:7b19:b0:d4:a361:fd3 with SMTP id s25-20020a056a207b1900b000d4a3610fd3mr6782048pzh.58.1681496855379; Fri, 14 Apr 2023 11:27:35 -0700 (PDT) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id u36-20020a634724000000b0050bd9c8c53dsm3027480pga.23.2023.04.14.11.27.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Apr 2023 11:27:35 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) Subject: Re: bug#62823: 29.0.60; Fixing a small leak in tree-sitter search functions From: Yuan Fu In-Reply-To: <83zg7bezc4.fsf@gnu.org> Date: Fri, 14 Apr 2023 11:27:22 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83zg7bezc4.fsf@gnu.org> To: Eli Zaretskii X-Mailer: Apple Mail (2.3731.500.231) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62823 Cc: 62823@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On Apr 13, 2023, at 11:45 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Thu, 13 Apr 2023 15:48:43 -0700 >>=20 >> When we switch to using cursors instead of nodes [1] in treesit.c for >> search functions, we introduced a small leak: the search functions >> allows the user to pass a predicate function, which can signal. And >> because we are now using cursors, which needs to be freed, everytime = the >> predicate function signals, the cursor is leaked. >>=20 >> I pushed a fix to master (a5eb9f6ad4e), the change is relatively >> straightforward so I hope we can pick it into the next pretest. >=20 > Thanks, but this kind of bugs should be fixed on the release branch to > begin with (I've backported it now). If you are unsure on which > branch to install such changes, please ask before installing. Oops. I=E2=80=99ll do that the next time. Yuan= From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 05 19:55:45 2023 Received: (at 62823-done) by debbugs.gnu.org; 5 Sep 2023 23:55:45 +0000 Received: from localhost ([127.0.0.1]:59911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdftZ-0005Zh-31 for submit@debbugs.gnu.org; Tue, 05 Sep 2023 19:55:45 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]:42246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdftX-0005ZS-8h for 62823-done@debbugs.gnu.org; Tue, 05 Sep 2023 19:55:43 -0400 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-500bbe3ef0eso459259e87.1 for <62823-done@debbugs.gnu.org>; Tue, 05 Sep 2023 16:55:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693958136; x=1694562936; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=MmwVnIuKCzCC62Fv9iRnYUPkIgB5uNkdopjMrGgN9fM=; b=hqZsSSxsJCZMBiJ9vDYwavpFxBqHVtdG9bVrrCgX1qPoTUy9tN1T+21m78ZxxeMWkm DJkeeaUrwJpNuICyUEuSyMBpgdF6IuUJ/VanPzfaSnL397kw1DGk2TjNNOhh7hEtjlvJ dM9GrIaLQMdD1UV051M2Vgrs3G+fMrfshE9Z2xUIWIM34LFlnavQpq90IFMGN269RXli 8RB+hqXpkre9QnZRyGKoq0398RDoJ5pCXqqwlVa1YsUtN/0iHmpuilQKvv9smJ8vj/kf efa9nKv9D7vmvzKDUcFvDSPTwZ35RbrWGzmN/vSpBEZE45F3DhQtUjoCElRtp3ducYY2 2Xqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693958136; x=1694562936; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MmwVnIuKCzCC62Fv9iRnYUPkIgB5uNkdopjMrGgN9fM=; b=GcqTwyB/KS4sSf83LAFYsFj76lJs9e5F0jL02I5Mg+XrsjRkIzM929/1U1SIdx1UsO 8wWeKoO+uLPN1p92akN8oBu4QdNK8EWbW/3Ut3s9iAXKoorkEE0OKbxIIhlmjwH1KuuW 87GGpaRUXgZgVDA2ObbT+JAxr8ua82+aimDxCaKC7Fs2ky0RP9Ed/a9/601CNbCUs5r9 gYOx2QGR9EUyZBM26t1AKwj+QaYDCyqlbGdRlJFLNLzHiazXPLw/n/vuY+bCMFgsSIag 1QKaAbqQyQtBoWTzhOzHukC9cY1LRaKtsGFZekgQOMFK0eMJW8UmT5NXPOj+yjAQYm9W tqyg== X-Gm-Message-State: AOJu0YwC9HNa6I+GpGUnUfjC3My/RJzw0jRV/081cgUEYmVy24Vd6ew1 Qt+AbNNTTNUcltrdy56HPa8G5p/FH9ZvWgH6ibM= X-Google-Smtp-Source: AGHT+IELf1Y2irLcmtOiqUvhGrxbN4u0PUgIwtTrWNjtByrVyOGvucsYg2RNAWy0tO67ReOR+lpRBewmZjqmROxN+7M= X-Received: by 2002:a05:6512:e97:b0:4fe:28cd:b3f with SMTP id bi23-20020a0565120e9700b004fe28cd0b3fmr439251lfb.5.1693958136371; Tue, 05 Sep 2023 16:55:36 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 5 Sep 2023 16:55:36 -0700 From: Stefan Kangas In-Reply-To: (Yuan Fu's message of "Thu, 13 Apr 2023 15:48:43 -0700") References: MIME-Version: 1.0 Date: Tue, 5 Sep 2023 16:55:36 -0700 Message-ID: Subject: Re: bug#62823: 29.0.60; Fixing a small leak in tree-sitter search functions To: Yuan Fu Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62823-done Cc: 62823-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Yuan Fu writes: > When we switch to using cursors instead of nodes [1] in treesit.c for > search functions, we introduced a small leak: the search functions > allows the user to pass a predicate function, which can signal. And > because we are now using cursors, which needs to be freed, everytime the > predicate function signals, the cursor is leaked. > > I pushed a fix to master (a5eb9f6ad4e), the change is relatively > straightforward so I hope we can pick it into the next pretest. > > And sorry for introducing the leak in the first place :-( It seems like this was already installed, so I'm closing this. From unknown Wed Jun 18 22:57:53 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 04 Oct 2023 11:24:14 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator