texinfo-commits
[Top][All Lists]
Advanced

[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: Tue, 20 Feb 2024 16:55:28 -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 6ac6e464b3 Fix memory leaks found with valgrind
6ac6e464b3 is described below

commit 6ac6e464b3622449cf203b9065dc81338a70240c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Feb 20 22:53:19 2024 +0100

    Fix memory leaks found with valgrind
    
    * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): free
    fullpath of verbatiminclude after adding to global_info included_files.
    
    * tp/Texinfo/XS/convert/convert_html.c (mini_toc_internal): set href
    after it is sure that the section is non empty and processed.
---
 ChangeLog                            | 10 ++++++++++
 tp/Texinfo/XS/convert/convert_html.c |  4 +++-
 tp/Texinfo/XS/parsetexi/end_line.c   |  1 +
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 6ed22359e9..6ee627e08d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-02-20  Patrice Dumas  <pertusus@free.fr>
+
+       Fix memory leaks found with valgrind
+
+       * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): free
+       fullpath of verbatiminclude after adding to global_info included_files.
+
+       * tp/Texinfo/XS/convert/convert_html.c (mini_toc_internal): set href
+       after it is sure that the section is non empty and processed.
+
 2024-02-20  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/XS:
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index ac3a57c6b2..dbbae01cab 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -9799,12 +9799,14 @@ mini_toc_internal (CONVERTER *self, const ELEMENT 
*element, TEXT *result)
           char *explanation;
           char *accesskey;
           char *text;
-          char *href = html_command_href (self, section, 0, 0, 0);
+          char *href;
 
           /* happens with empty sectioning command */
           if (!command_tree->tree)
             continue;
 
+          href = html_command_href (self, section, 0, 0, 0);
+
           xasprintf (&explanation, "mini_toc @%s",
                      element_command_name (section));
           text = html_convert_tree (self, command_tree->tree, explanation);
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index 5f8fb2b6b6..051a2dc1ac 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1328,6 +1328,7 @@ end_line_misc_line (ELEMENT *current)
               fullpath = parser_locate_include_file (sys_filename);
               if (fullpath && access (fullpath, R_OK) == 0)
                 add_string (fullpath, &global_info.included_files);
+              free (fullpath);
             }
           else if (current->cmd == CM_documentencoding)
             {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]