[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/tree-sitter 3a5c4bdc0c: Fix crash on MS-Windows due to memory-al
From: |
Eli Zaretskii |
Subject: |
feature/tree-sitter 3a5c4bdc0c: Fix crash on MS-Windows due to memory-allocation problem in treesit.c |
Date: |
Sun, 13 Nov 2022 03:52:40 -0500 (EST) |
branch: feature/tree-sitter
commit 3a5c4bdc0c079f72bad98e01f70343ba9e9b0043
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
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.
---
src/treesit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/treesit.c b/src/treesit.c
index 854d7754f0..86328ae03e 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -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)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/tree-sitter 3a5c4bdc0c: Fix crash on MS-Windows due to memory-allocation problem in treesit.c,
Eli Zaretskii <=