[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, 06 Jan 2024 09:35:15 -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 7d0041e53a Fix memory leaks found with valgrind
7d0041e53a is described below
commit 7d0041e53a0f227e758c1c3b56d7da239db2b7f1
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jan 6 15:35:13 2024 +0100
Fix memory leaks found with valgrind
* tp/Texinfo/XS/convert/convert_html.c
(html_default_format_css_lines): destroy css_element_classes.
* tp/Texinfo/XS/convert/convert_html.c (convert_printindex_command):
do not reset multiple_pass_str.
* tp/Texinfo/XS/convert/convert_html.c
(html_default_format_node_redirection_page, convert_style_command)
(convert_def_line_type): free/destroy variables.
* tp/Texinfo/XS/convert/convert_html.c (html_free_converter): free css
info data.
---
ChangeLog | 17 +++++++++++++++
tp/TODO | 3 ---
tp/Texinfo/XS/convert/convert_html.c | 41 +++++++++++++++++++++++++-----------
3 files changed, 46 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 74d8ca63ab..c41e470a4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2024-01-06 Patrice Dumas <pertusus@free.fr>
+
+ Fix memory leaks found with valgrind
+
+ * tp/Texinfo/XS/convert/convert_html.c
+ (html_default_format_css_lines): destroy css_element_classes.
+
+ * tp/Texinfo/XS/convert/convert_html.c (convert_printindex_command):
+ do not reset multiple_pass_str.
+
+ * tp/Texinfo/XS/convert/convert_html.c
+ (html_default_format_node_redirection_page, convert_style_command)
+ (convert_def_line_type): free/destroy variables.
+
+ * tp/Texinfo/XS/convert/convert_html.c (html_free_converter): free css
+ info data.
+
2024-01-06 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_default_format_button): avoid 2 if for
diff --git a/tp/TODO b/tp/TODO
index 3058332150..f2c2baf67b 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -40,9 +40,6 @@ index[$index_name][number] = { 'index_name' =>
$index_name,
INDEX_ENTRY *index_entry;
index_entry = idx->index_entries[j];
main_entry_element = index_entry->entry_element;
-extra normalized
-root_commands : find through associated output unit or linear search in root
-global commands: add an index
Bugs
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 6b39654a4d..430a64bc75 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -6732,7 +6732,11 @@ html_default_format_css_lines (CONVERTER *self, const
char *filename,
&& (!css_element_classes || css_element_classes->number <= 0)
&& css_rule_lines->number <= 0
&& (!css_refs || css_refs->number <= 0))
- return;
+ {
+ if (css_element_classes)
+ destroy_strings_list (css_element_classes);
+ return;
+ }
text_append (result, "<style type=\"text/css\">\n<!--\n");
@@ -6743,17 +6747,22 @@ html_default_format_css_lines (CONVERTER *self, const
char *filename,
text_append_n (result, "\n", 1);
}
- if (css_element_classes && css_element_classes->number > 0)
+ if (css_element_classes)
{
- for (i = 0; i < css_element_classes->number; i++)
+ if (css_element_classes->number > 0)
{
- const char *selector = css_element_classes->list[i];
- CSS_SELECTOR_STYLE *selector_style
- = find_css_selector_style (&self->css_element_class_styles,
- selector);
- if (selector_style->style)
- text_printf (result, "%s {%s}\n", selector, selector_style->style);
+ for (i = 0; i < css_element_classes->number; i++)
+ {
+ const char *selector = css_element_classes->list[i];
+ CSS_SELECTOR_STYLE *selector_style
+ = find_css_selector_style (&self->css_element_class_styles,
+ selector);
+ if (selector_style->style)
+ text_printf (result, "%s {%s}\n", selector,
+ selector_style->style);
+ }
}
+ destroy_strings_list (css_element_classes);
}
if (css_rule_lines->number > 0)
@@ -8194,6 +8203,8 @@ html_default_format_node_redirection_page (CONVERTER
*self,
destroy_named_string_element_list (substrings);
free (href);
+ destroy_begin_file_information (begin_info);
+
return result.text;
}
@@ -8461,9 +8472,11 @@ convert_style_command (CONVERTER *self, const enum
command_id cmd,
{
text_append (result, open);
text_append_n (result, ">", 1);
- free (open);
}
+ if (open)
+ free (open);
+
text_append (result, args_formatted->args[0].formatted[AFT_type_normal]);
if (open_len > 0)
@@ -12644,8 +12657,6 @@ convert_printindex_command (CONVERTER *self, const enum
command_id cmd,
if (*formatted_index_entry_nr > 1)
{
/* call with multiple_pass argument */
- xasprintf (&multiple_pass_str, "index-formatted-%d",
- *formatted_index_entry_nr);
entry = convert_tree_new_formatting_context (self,
entry_trees[level], convert_info,
multiple_pass_str, 0, 0);
@@ -14560,6 +14571,8 @@ convert_def_line_type (CONVERTER *self, const enum
element_type type,
destroy_element_and_children (category_tree);
}
text_append_n (result, "]</td></tr>\n", 12);
+
+ destroy_parsed_def (parsed_def);
return;
}
@@ -16504,6 +16517,10 @@ html_free_converter (CONVERTER *self)
}
free (self->css_element_class_styles.list);
+ free_strings_list (&self->css_element_class_list);
+ free_strings_list (&self->css_rule_lines);
+ free_strings_list (&self->css_import_lines);
+
for (i = 0; i < self->no_arg_formatted_cmd.number; i++)
{
enum command_id cmd = self->no_arg_formatted_cmd.list[i];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Fix memory leaks found with valgrind,
Patrice Dumas <=