[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Sun, 30 Jul 2023 15:38:16 -0400 (EDT) |
branch: master
commit 69fc96b273f4f01e2e8963361565ab7fbaaf2bfe
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Jul 30 20:38:03 2023 +0100
* tp/Texinfo/XS/parsetexi/separator.c (handle_comma):
Keep copy of return value of next_text so to avoid a memory
leak.
---
ChangeLog | 6 ++++++
tp/Texinfo/XS/parsetexi/separator.c | 4 +++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index fcb16320dc..0122583acb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-07-30 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/Texinfo/XS/parsetexi/separator.c (handle_comma):
+ Keep copy of return value of next_text so to avoid a memory
+ leak.
+
2023-07-30 Gavin Smith <gavinsmith0123@gmail.com>
* tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args)
diff --git a/tp/Texinfo/XS/parsetexi/separator.c
b/tp/Texinfo/XS/parsetexi/separator.c
index 469ac9ef27..ec1e48ef16 100644
--- a/tp/Texinfo/XS/parsetexi/separator.c
+++ b/tp/Texinfo/XS/parsetexi/separator.c
@@ -656,6 +656,7 @@ handle_comma (ELEMENT *current, char **line_inout)
/* Scan forward to get the next argument. */
while (brace_count > 0)
{
+ static char *alloc_line;
size_t non_separator_len = strcspn (line, "{},");
if (non_separator_len > 0)
text_append_n (&arg->text, line, non_separator_len);
@@ -681,7 +682,8 @@ handle_comma (ELEMENT *current, char **line_inout)
break;
default:
/* at the end of line */
- line = next_text (e);
+ free (alloc_line);
+ line = alloc_line = next_text (e);
if (!line)
goto funexit;
continue;