texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/XS/convert/convert_html.c (reset_uns


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (reset_unset_no_arg_commands_formatting_context): free reset translated_converted and strdup set string.
Date: Fri, 20 Oct 2023 18:36:21 -0400

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 e194c4456b * tp/Texinfo/XS/convert/convert_html.c 
(reset_unset_no_arg_commands_formatting_context): free reset 
translated_converted and strdup set string.
e194c4456b is described below

commit e194c4456b12d05c40da41a05eea899261898a80
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Oct 21 00:36:22 2023 +0200

    * tp/Texinfo/XS/convert/convert_html.c
    (reset_unset_no_arg_commands_formatting_context): free reset
    translated_converted and strdup set string.
    
    * tp/Texinfo/XS/convert/convert_html.c (prepare_special_units):
    free contents contents_option_ref in every cases.
    
    * tp/Texinfo/XS/structuring_transfo/structuring.c
    (sectioning_structure): free appendix_nr.
---
 ChangeLog                                       | 12 ++++++++++++
 tp/Texinfo/XS/convert/convert_html.c            | 14 +++++++++++---
 tp/Texinfo/XS/structuring_transfo/structuring.c |  1 +
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7af248af5b..1d982c02bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2023-10-19  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c
+       (reset_unset_no_arg_commands_formatting_context): free reset
+       translated_converted and strdup set string.
+
+       * tp/Texinfo/XS/convert/convert_html.c (prepare_special_units):
+       free contents contents_option_ref in every cases.
+
+       * tp/Texinfo/XS/structuring_transfo/structuring.c
+       (sectioning_structure): free appendix_nr.
+
 2023-10-19  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/tree.c (spare_element, reset_obstacks)
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index a7ecc38ad0..4dcc80c41c 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -213,13 +213,18 @@ reset_unset_no_arg_commands_formatting_context (CONVERTER 
*self,
           HTML_COMMAND_CONVERSION *no_arg_ref
             = conversion_contexts[ref_context];
 
+          /* TODO memory leaks possible for the other char * fields */
+
           if (no_arg_ref->text)
             no_arg_command_context->text = no_arg_ref->text;
           if (no_arg_ref->tree)
             no_arg_command_context->tree = no_arg_ref->tree;
           if (no_arg_ref->translated_converted)
-            no_arg_command_context->translated_converted
-              = no_arg_ref->translated_converted;
+            {
+              free (no_arg_command_context->translated_converted);
+              no_arg_command_context->translated_converted
+                = strdup (no_arg_ref->translated_converted);
+            }
           if (no_arg_ref->translated_to_convert)
             no_arg_command_context->translated_to_convert
               = no_arg_ref->translated_to_convert;
@@ -667,10 +672,14 @@ prepare_special_units (CONVERTER *self, int 
output_units_descriptor,
       int i;
       for (i = 0; i < 2; i++)
         {
+          int contents_set = 0;
           enum command_id cmd = contents_cmds[i];
           COMMAND_OPTION_REF *contents_option_ref
              = get_command_option (self->conf, cmd);
           if (*(contents_option_ref->int_ref) > 0)
+            contents_set = 1;
+          free (contents_option_ref);
+          if (contents_set)
             {
               int j;
               char *special_unit_variety = 0;
@@ -741,7 +750,6 @@ prepare_special_units (CONVERTER *self, int 
output_units_descriptor,
                                            special_output_unit);
                 }
             }
-          free (contents_option_ref);
         }
     }
 
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c 
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index 42afb2633f..5617e3975f 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -328,6 +328,7 @@ sectioning_structure (DOCUMENT *document)
                   char *appendix_nr = enumerate_item_representation ("A",
                                             command_numbers[number_top_level]);
                   text_append_n (&section_number, appendix_nr, 1);
+                  free (appendix_nr);
                 }
               for (i = number_top_level+1; i <= level; i++)
                 {



reply via email to

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