texinfo-commits
[Top][All Lists]
Advanced

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

[8385] parsetexi fix some memory leaks


From: gavinsmith0123
Subject: [8385] parsetexi fix some memory leaks
Date: Tue, 23 Oct 2018 17:32:22 -0400 (EDT)

Revision: 8385
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8385
Author:   gavin
Date:     2018-10-23 17:32:21 -0400 (Tue, 23 Oct 2018)
Log Message:
-----------
parsetexi fix some memory leaks

Modified Paths:
--------------
    trunk/tp/Texinfo/XS/parsetexi/convert.c
    trunk/tp/Texinfo/XS/parsetexi/end_line.c
    trunk/tp/Texinfo/XS/parsetexi/handle_commands.c

Modified: trunk/tp/Texinfo/XS/parsetexi/convert.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/convert.c     2018-10-23 15:42:18 UTC (rev 
8384)
+++ trunk/tp/Texinfo/XS/parsetexi/convert.c     2018-10-23 21:32:21 UTC (rev 
8385)
@@ -30,6 +30,7 @@
 
 #define ADD(x) text_append (result, x)
 
+/* Return value to be freed by caller. */
 char *
 node_extra_to_texi (NODE_SPEC_EXTRA *nse)
 {

Modified: trunk/tp/Texinfo/XS/parsetexi/end_line.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/end_line.c    2018-10-23 15:42:18 UTC (rev 
8384)
+++ trunk/tp/Texinfo/XS/parsetexi/end_line.c    2018-10-23 21:32:21 UTC (rev 
8385)
@@ -33,8 +33,9 @@
   if (nse && nse->manual_content
       && nse->manual_content->contents.number > 0)
     {
-      line_error ("syntax for an external node used for `%s'",
-                  node_extra_to_texi (nse));
+      char *texi = node_extra_to_texi (nse);
+      line_error ("syntax for an external node used for `%s'", texi);
+      free (texi);
     }
 }
 
@@ -1444,6 +1445,7 @@
                                      "@include: could not open %s:",
                                      text,
                                      strerror (status));
+                      free (fullpath);
                     }
                   else
                     included_file = 1;

Modified: trunk/tp/Texinfo/XS/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/handle_commands.c     2018-10-23 15:42:18 UTC 
(rev 8384)
+++ trunk/tp/Texinfo/XS/parsetexi/handle_commands.c     2018-10-23 21:32:21 UTC 
(rev 8385)
@@ -775,7 +775,6 @@
       if (cmd == CM_ifclear || cmd == CM_ifset
           || cmd == CM_ifcommanddefined || cmd == CM_ifcommandnotdefined)
         {
-          char *flag;
           char *p = line;
           p = line + strspn (line, whitespace_chars);
           if (!*p)
@@ -782,7 +781,7 @@
             line_error ("@%s requires a name", command_name(cmd));
           else
             {
-              flag = read_command_name (&p);
+              char *flag = read_command_name (&p);
               if (!flag)
                 goto bad_value;
               else
@@ -826,7 +825,7 @@
               bad_value:
                   line_error ("bad name for @%s", command_name(cmd));
                 }
-
+              free (flag);
             }
         }
       else if (!memcmp (command_name(cmd), "if", 2)) //4687




reply via email to

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