]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix crashes inside 'xfree' called from treesit.c
authorEli Zaretskii <eliz@gnu.org>
Tue, 7 Feb 2023 19:53:05 +0000 (21:53 +0200)
committerEli Zaretskii <eliz@gnu.org>
Tue, 7 Feb 2023 19:53:05 +0000 (21:53 +0200)
* src/treesit.c (treesit_load_language): Always xstrdup 'c_name',
to avoid crashes inside xfree.  (Bug#61351)

src/treesit.c

index 8e772523cc7f2d65b91cbe00131c82b43c2df11a..b15d44fca0190a7dc449c3aa312e9b51a3c1e639 100644 (file)
@@ -620,7 +620,7 @@ treesit_load_language (Lisp_Object language_symbol,
   char *c_name = xstrdup (SSDATA (base_name));
   treesit_symbol_to_c_name (c_name);
   if (found_override)
-    c_name = SSDATA (override_c_name);
+    c_name = xstrdup (SSDATA (override_c_name));
   langfn = dynlib_sym (handle, c_name);
   xfree (c_name);
   error = dynlib_error ();