Fix crash on MS-Windows due to memory-allocation problem in treesit.c
* src/treesit.c (treesit_load_language): Use 'xstrdup'/'xfree' instead of 'strdup'/'free', to prevent crashes on MS-Windows, where we must use our own implementation of 'malloc'/'free', whereas 'strdup' uses the default implementation in the MS-Windows C runtime library.
This commit is contained in:
parent
908aab6144
commit
3a5c4bdc0c
1 changed files with 2 additions and 2 deletions
|
@ -578,12 +578,12 @@ treesit_load_language (Lisp_Object language_symbol,
|
|||
/* Load TSLanguage. */
|
||||
dynlib_error ();
|
||||
TSLanguage *(*langfn) (void);
|
||||
char *c_name = strdup (SSDATA (base_name));
|
||||
char *c_name = xstrdup (SSDATA (base_name));
|
||||
treesit_symbol_to_c_name (c_name);
|
||||
if (found_override)
|
||||
c_name = SSDATA (override_c_name);
|
||||
langfn = dynlib_sym (handle, c_name);
|
||||
free (c_name);
|
||||
xfree (c_name);
|
||||
error = dynlib_error ();
|
||||
if (error != NULL)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue