From: Eli Zaretskii Date: Wed, 8 Feb 2023 16:40:50 +0000 (+0200) Subject: ; Fix memory leak in treesit.c X-Git-Tag: emacs-29.0.90~470 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d11d7aee1a6;p=emacs.git ; Fix memory leak in treesit.c * src/treesit.c (treesit_load_language): Fix a memory leak. Reported by Eric Gillespie . --- diff --git a/src/treesit.c b/src/treesit.c index b15d44fca01..cfa3721b5e7 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -617,10 +617,14 @@ treesit_load_language (Lisp_Object language_symbol, eassume (handle != NULL); dynlib_error (); TSLanguage *(*langfn) (void); - char *c_name = xstrdup (SSDATA (base_name)); - treesit_symbol_to_c_name (c_name); + char *c_name; if (found_override) c_name = xstrdup (SSDATA (override_c_name)); + else + { + c_name = xstrdup (SSDATA (base_name)); + treesit_symbol_to_c_name (c_name); + } langfn = dynlib_sym (handle, c_name); xfree (c_name); error = dynlib_error ();