[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Mon, 23 Dec 2024 17:44:50 -0500 (EST) |
branch: master
commit 7c8ca6242bc1c0c349dfb4d3f020476a86041010
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Dec 7 21:37:19 2024 +0100
Fix memory leaks in teximakehtml (from valgrind)
* tp/Texinfo/XS/teximakehtml.c (document_warn): free encoded_message.
* tp/Texinfo/XS/teximakehtml.c (main): strdup top_builddir if coming
from getenv. Free top_builddir. Destroy format_defaults.
---
ChangeLog | 9 +++++++++
tp/Texinfo/XS/teximakehtml.c | 13 ++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 1174ac0e04..c6ce874845 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-12-07 Patrice Dumas <pertusus@free.fr>
+
+ Fix memory leaks in teximakehtml (from valgrind)
+
+ * tp/Texinfo/XS/teximakehtml.c (document_warn): free encoded_message.
+
+ * tp/Texinfo/XS/teximakehtml.c (main): strdup top_builddir if coming
+ from getenv. Free top_builddir. Destroy format_defaults.
+
2024-12-06 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/teximakehtml.c (get_cmdline_customization_option):
diff --git a/tp/Texinfo/XS/teximakehtml.c b/tp/Texinfo/XS/teximakehtml.c
index 6294cba69a..d544243fa1 100644
--- a/tp/Texinfo/XS/teximakehtml.c
+++ b/tp/Texinfo/XS/teximakehtml.c
@@ -48,6 +48,8 @@
#include "convert_to_texinfo.h"
*/
#include "create_buttons.h"
+/* destroy_converter_initialization_info */
+#include "converter.h"
#include "texinfo.h"
#define LOCALEDIR DATADIR "/locale"
@@ -169,7 +171,10 @@ document_warn (const char *format, ...)
encoded_message = encode_message (formatted_message);
if (encoded_message)
- fprintf (stderr, "%s\n", encoded_message);
+ {
+ fprintf (stderr, "%s\n", encoded_message);
+ free (encoded_message);
+ }
}
void
@@ -284,9 +289,13 @@ main (int argc, char *argv[])
if (!top_builddir)
/* this is correct for in-source builds only. */
top_builddir = strdup (top_srcdir);
+ else
+ top_builddir = strdup (top_builddir);
xasprintf (&tp_builddir, "%s/tp", top_builddir);
+ free (top_builddir);
+
txi_general_setup (1, 0, tp_builddir, top_srcdir);
free (tp_builddir);
@@ -437,6 +446,8 @@ main (int argc, char *argv[])
&format_defaults->conf.options->FORMAT_MENU);
}
+ destroy_converter_initialization_info (format_defaults);
+
/* TODO add program_options filtering in only parser options */
initialize_options_list (&parser_options);
/*