texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/main/build_perl_info.c (build_per


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/main/build_perl_info.c (build_perl_array) (build_perl_const_element_array, build_perl_directions) (build_additional_info, build_indices_sort_strings) (build_sorted_indices_by_index, build_sorted_indices_by_letter) (output_unit_to_perl_hash, html_build_button): use non_perl_free to free a string allocated by xasprintf (from utils.c) or from print_element_debug (from errors.c), to avoid mixxing Perl/non Perl memory management functions. Based on a report from Eli.
Date: Sun, 08 Dec 2024 10:52:03 -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 7170d5efbf * tp/Texinfo/XS/main/build_perl_info.c (build_perl_array) 
(build_perl_const_element_array, build_perl_directions) (build_additional_info, 
build_indices_sort_strings) (build_sorted_indices_by_index, 
build_sorted_indices_by_letter) (output_unit_to_perl_hash, html_build_button): 
use non_perl_free to free a string allocated by xasprintf (from utils.c) or 
from print_element_debug (from errors.c), to avoid mixxing Perl/non Perl memory 
management functions.  Based on a report [...]
7170d5efbf is described below

commit 7170d5efbf8e9f80dab3c7032c1e30764c79349e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Dec 8 16:51:56 2024 +0100

    * tp/Texinfo/XS/main/build_perl_info.c (build_perl_array)
    (build_perl_const_element_array, build_perl_directions)
    (build_additional_info, build_indices_sort_strings)
    (build_sorted_indices_by_index, build_sorted_indices_by_letter)
    (output_unit_to_perl_hash, html_build_button): use non_perl_free to
    free a string allocated by xasprintf (from utils.c) or from
    print_element_debug (from errors.c), to avoid mixxing Perl/non Perl
    memory management functions.  Based on a report from Eli.
---
 ChangeLog                            | 11 +++++++++++
 tp/Texinfo/XS/main/build_perl_info.c | 34 ++++++++++++++--------------------
 2 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c9929e6a8a..390e1bc33e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-12-08  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/build_perl_info.c (build_perl_array)
+       (build_perl_const_element_array, build_perl_directions)
+       (build_additional_info, build_indices_sort_strings)
+       (build_sorted_indices_by_index, build_sorted_indices_by_letter)
+       (output_unit_to_perl_hash, html_build_button): use non_perl_free to
+       free a string allocated by xasprintf (from utils.c) or from
+       print_element_debug (from errors.c), to avoid mixxing Perl/non Perl
+       memory management functions.  Based on a report from Eli.
+
 2024-12-08  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/Makefile.am (libtexinfo_convert_la_CPPFLAGS): remove
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index 91da10f7ed..1f71646915 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -206,11 +206,9 @@ build_perl_array (const ELEMENT_LIST *e_l, int 
avoid_recursion)
               text_init (&message);
               text_printf (&message,
                 "BUG: build_perl_array oot %d: %s\n", i, debug_str);
-      /* Calling free in this file on data possibly allocated with gnulib
-         is not ok in general, but ok here, as it should never be called */
-              free (debug_str);
+              non_perl_free (debug_str);
               fprintf (stderr, "%s", message.text);
-              free (message.text);
+              non_perl_free (message.text);
               /* Out-of-tree element */
               /* WARNING: This is possibly recursive. */
               element_to_perl_hash (e_l->list[i], avoid_recursion);
@@ -250,11 +248,9 @@ build_perl_const_element_array (const CONST_ELEMENT_LIST 
*e_l, int avoid_recursi
               text_init (&message);
               text_printf (&message,
                 "BUG: build_perl_const_element_array oot %d: %s\n", i, 
debug_str);
-      /* Calling free in this file on data possibly allocated with gnulib
-         is not ok in general, but ok here, as it should never be called */
-              free (debug_str);
+              non_perl_free (debug_str);
               fprintf (stderr, "%s", message.text);
-              free (message.text);
+              non_perl_free (message.text);
               /* Out-of-tree element */
               /* WARNING: This is possibly recursive. */
               element_to_perl_hash (f, avoid_recursion);
@@ -316,11 +312,9 @@ build_perl_directions (const ELEMENT * const *e_l, int 
avoid_recursion)
                   text_init (&message);
                   text_printf (&message,
                     "BUG: build_perl_directions oot %s: %s\n", key, debug_str);
-      /* Calling free in this file on data possibly allocated with gnulib
-         is not ok in general, but ok here, as it should never be called */
-                  free (debug_str);
+                  non_perl_free (debug_str);
                   fprintf (stderr, "%s", message.text);
-                  free (message.text);
+                  non_perl_free (message.text);
                   /* Out-of-tree element */
                   /* WARNING: This is possibly recursive. */
                   element_to_perl_hash (f, avoid_recursion);
@@ -405,7 +399,7 @@ build_additional_info (HV *extra, const ASSOCIATED_INFO *a,
                   text_printf (&message,
                         "element_to_perl_hash oot %s double in %s %p\n",
                                key, debug_str, f->hv);
-                  free (debug_str);
+                  non_perl_free (debug_str);
                   fatal (message.text);
                   fprintf (stderr, message.text);
                 }
@@ -2240,7 +2234,7 @@ build_indices_sort_strings (const INDICES_SORT_STRINGS 
*indices_sort_strings,
                 = find_idx_name_entry_number_sv (indices_information_hv,
                                                  entry_index_name, 
entry_number,
                                                  message);
-              free (message);
+              non_perl_free (message);
 
               /* probably not possible, unless there is a bug */
               if (!index_entry_sv)
@@ -2324,7 +2318,7 @@ build_sorted_indices_by_index (
             = find_idx_name_entry_number_sv (indices_information_hv,
                                              index_name, entry_number,
                                              message);
-          free (message);
+          non_perl_free (message);
 
           if (index_entry_sv)
             {
@@ -2393,7 +2387,7 @@ build_sorted_indices_by_letter (
                 = find_idx_name_entry_number_sv (indices_information_hv,
                                                  index_name, entry_number,
                                                  message);
-              free (message);
+              non_perl_free (message);
 
               if (index_entry_sv)
                 {
@@ -2494,7 +2488,7 @@ output_unit_to_perl_hash (OUTPUT_UNIT *output_unit)
               xasprintf (&msg, "BUG: no output unit Perl ref: %s",
                                    output_unit_texi (direction_unit));
               fatal (msg);
-              free (msg);
+              non_perl_free (msg);
             }
           unit_sv = newRV_inc ((SV *) direction_unit->hv);
           hv_store (directions_hv, direction_name, strlen (direction_name),
@@ -2874,7 +2868,7 @@ html_build_button (const CONVERTER *converter, 
BUTTON_SPECIFICATION *button,
             xasprintf (&msg, "No name for button direction %d",
                        button->b.direction);
             fatal (msg);
-            free (msg);
+            non_perl_free (msg);
           }
         return newSVpv_utf8 (direction_name, 0);
         break;
@@ -2896,7 +2890,7 @@ html_build_button (const CONVERTER *converter, 
BUTTON_SPECIFICATION *button,
               xasprintf (&msg, "No name for array button direction %d",
                               button_spec->direction);
               fatal (msg);
-              free (msg);
+              non_perl_free (msg);
             }
 
           if (button_spec->type == BIT_function)
@@ -2915,7 +2909,7 @@ html_build_button (const CONVERTER *converter, 
BUTTON_SPECIFICATION *button,
                   if (!button_function_cv)
                     fprintf (stderr, "BUG: %s: not found\n", sub_full_name);
 
-                  free (sub_full_name);
+                  non_perl_free (sub_full_name);
 
                   button_spec_info_av = newAV ();
                   av_push (button_spec_info_av,



reply via email to

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