[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Fix memory leaks (found with valgrind)
From: |
Patrice Dumas |
Subject: |
branch master updated: Fix memory leaks (found with valgrind) |
Date: |
Sat, 30 Dec 2023 05:06:49 -0500 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new cf9a9de973 Fix memory leaks (found with valgrind)
cf9a9de973 is described below
commit cf9a9de9732ffd4b4ac357dfa4c4a169047dbed4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Dec 30 11:06:45 2023 +0100
Fix memory leaks (found with valgrind)
* tp/Texinfo/XS/convert/convert_html.c (convert_image_command): free
image_path_info.
* tp/Texinfo/XS/convert/convert_html.c (convert_math_command):
properly free memory before exiting.
* tp/Texinfo/XS/main/unicode.c (format_eight_bit_accents_stack):
free encoded_u8, new_eight_bit and prev_eight_bit.
---
ChangeLog | 13 +++++++++++++
tp/Texinfo/XS/convert/convert_html.c | 4 +++-
tp/Texinfo/XS/main/unicode.c | 9 +++++++--
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 78f03cd8db..ba9c963620 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-12-30 Patrice Dumas <pertusus@free.fr>
+
+ Fix memory leaks (found with valgrind)
+
+ * tp/Texinfo/XS/convert/convert_html.c (convert_image_command): free
+ image_path_info.
+
+ * tp/Texinfo/XS/convert/convert_html.c (convert_math_command):
+ properly free memory before exiting.
+
+ * tp/Texinfo/XS/main/unicode.c (format_eight_bit_accents_stack):
+ free encoded_u8, new_eight_bit and prev_eight_bit.
+
2023-12-30 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/convert_html.c (direction_string)
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index b610299eeb..8b07e37264 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -8916,6 +8916,7 @@ convert_image_command (CONVERTER *self, const enum
command_id cmd,
image_basefile, image_file);
}
free_image_file_location_info (image_path_info);
+ free (image_path_info);
if (self->conf->IMAGE_LINK_PREFIX)
{
@@ -8982,13 +8983,14 @@ convert_math_command (CONVERTER *self, const enum
command_id cmd,
attribute_class = html_attribute_class (self, "em", classes);
text_append (result, attribute_class);
text_printf (result, ">\\(%s\\)</em>", arg);
- return;
+ goto out;
}
attribute_class = html_attribute_class (self, "em", classes);
text_append (result, attribute_class);
text_printf (result, ">%s</em>", arg);
+ out:
destroy_strings_list (classes);
free (attribute_class);
}
diff --git a/tp/Texinfo/XS/main/unicode.c b/tp/Texinfo/XS/main/unicode.c
index 27cc6ee53a..832ed414dc 100644
--- a/tp/Texinfo/XS/main/unicode.c
+++ b/tp/Texinfo/XS/main/unicode.c
@@ -218,7 +218,7 @@ format_eight_bit_accents_stack (CONVERTER *self, const char
*text,
to the character.
*/
- prev_eight_bit = strdup("");
+ prev_eight_bit = strdup ("");
for (j = stack_nr; j >= i; j--)
{
@@ -231,6 +231,7 @@ format_eight_bit_accents_stack (CONVERTER *self, const char
*text,
iconveh_question_mark);
ucs4_t first_char;
u8_next (&first_char, encoded_u8);
+ free (encoded_u8);
if (first_char < 127)
xasprintf(&new_eight_bit, "%02lX", first_char);
else
@@ -274,9 +275,13 @@ format_eight_bit_accents_stack (CONVERTER *self, const
char *text,
if (!strcmp (new_eight_bit, prev_eight_bit)
&& !(stack->stack[j]->cmd == CM_dotless
&& !strcmp (results_stack[j], "i")))
- break;
+ {
+ free (new_eight_bit);
+ break;
+ }
free (result);
result = strdup (results_stack[j]);
+ free (prev_eight_bit);
prev_eight_bit = strdup (new_eight_bit);
free (new_eight_bit);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Fix memory leaks (found with valgrind),
Patrice Dumas <=