[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[8099] parsetexi fix some memory leaks
From: |
gavinsmith0123 |
Subject: |
[8099] parsetexi fix some memory leaks |
Date: |
Fri, 17 Aug 2018 05:14:15 -0400 (EDT) |
Revision: 8099
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8099
Author: gavin
Date: 2018-08-17 05:14:14 -0400 (Fri, 17 Aug 2018)
Log Message:
-----------
parsetexi fix some memory leaks
Modified Paths:
--------------
trunk/tp/Texinfo/XS/parsetexi/commands.c
trunk/tp/Texinfo/XS/parsetexi/input.c
trunk/tp/Texinfo/XS/parsetexi/macro.c
Modified: trunk/tp/Texinfo/XS/parsetexi/commands.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/commands.c 2018-08-16 18:05:23 UTC (rev
8098)
+++ trunk/tp/Texinfo/XS/parsetexi/commands.c 2018-08-17 09:14:14 UTC (rev
8099)
@@ -97,12 +97,15 @@
{
cmd &= ~USER_COMMAND_BIT;
free (user_defined_command_data[cmd].cmdname);
- user_defined_command_data[cmd].cmdname = "";
+ user_defined_command_data[cmd].cmdname = strdup ("");
}
void
wipe_user_commands (void)
{
+ int i;
+ for (i = 0; i < user_defined_number; i++)
+ free (user_defined_command_data[i].cmdname);
user_defined_number = 0;
}
Modified: trunk/tp/Texinfo/XS/parsetexi/input.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/input.c 2018-08-16 18:05:23 UTC (rev
8098)
+++ trunk/tp/Texinfo/XS/parsetexi/input.c 2018-08-17 09:14:14 UTC (rev
8099)
@@ -464,8 +464,23 @@
void
input_reset_input_stack (void)
{
+ int i;
input_number = 0;
- /* TODO: free the memory */
+ return;
+ for (i = 0; i < input_number; i++)
+ {
+ switch (input_stack[i].type)
+ {
+ case IN_file:
+ fclose (input_stack[i].file);
+ free (input_stack[i].text);
+ break;
+ case IN_text:
+ free (input_stack[i].text);
+ break;
+ }
+ }
+ input_number = 0;
}
int
Modified: trunk/tp/Texinfo/XS/parsetexi/macro.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/macro.c 2018-08-16 18:05:23 UTC (rev
8098)
+++ trunk/tp/Texinfo/XS/parsetexi/macro.c 2018-08-17 09:14:14 UTC (rev
8099)
@@ -464,7 +464,10 @@
if (!m)
return;
m->cmd = 0;
- m->macro_name = "";
+ free (m->macro_name);
+ m->macro_name = strdup ("");
+ free (m->macrobody);
+ m->macrobody = 0;
m->element = 0;
remove_texinfo_command (cmd);
}
@@ -472,6 +475,13 @@
void
wipe_macros (void)
{
+ int i;
+
+ for (i = 0; i < macro_number; i++)
+ {
+ free (macro_list[i].macro_name);
+ free (macro_list[i].macrobody);
+ }
macro_number = 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [8099] parsetexi fix some memory leaks,
gavinsmith0123 <=