texinfo-commits
[Top][All Lists]
Advanced

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

[5702] memory leaks, fix for tests, path separator portability define


From: Gavin D. Smith
Subject: [5702] memory leaks, fix for tests, path separator portability define
Date: Sun, 06 Jul 2014 19:34:34 +0000

Revision: 5702
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5702
Author:   gavin
Date:     2014-07-06 19:34:32 +0000 (Sun, 06 Jul 2014)
Log Message:
-----------
memory leaks, fix for tests, path separator portability define

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/dir.c
    trunk/info/filesys.c
    trunk/info/info-utils.c
    trunk/info/info.c
    trunk/info/nodes.c
    trunk/info/t/next-quoted.sh
    trunk/info/t/split-index.sh
    trunk/info/window.c
    trunk/system.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-07-05 19:39:16 UTC (rev 5701)
+++ trunk/ChangeLog     2014-07-06 19:34:32 UTC (rev 5702)
@@ -1,3 +1,19 @@
+2014-07-06  Gavin Smith  <address@hidden>
+
+       * info/dir.c (lookup_dir_entry): Free return value of get_dir_node.
+       * info/window.c (window_delete_window): Free line map on window close.
+       * info/nodes.c (info_find_file): Free a string before exit.
+       * info/info-utils.c (scan_reference_label): Free empty string before
+       exit.
+
+       * system.h [O_BINARY, !O_BINARY] (HAS_SLASH): New macro.
+       * info/filesys.c (info_find_fullpath) 
+       * info/info.c (main)
+       * info/nodes.c (info_find_file): Call it.
+
+       * info/t/split-index.sh, info/t/next-quoted.sh: Feed input keystrokes
+       with background process.
+
 2014-07-05  Gavin Smith  <address@hidden>
 
        * info/info-utils.c (parse_top_node_line): Free string before loop

Modified: trunk/info/dir.c
===================================================================
--- trunk/info/dir.c    2014-07-05 19:39:16 UTC (rev 5701)
+++ trunk/info/dir.c    2014-07-06 19:34:32 UTC (rev 5702)
@@ -257,6 +257,7 @@
   REFERENCE *entry;
 
   entry = info_get_menu_entry_by_label (node, label, sloppy);
+  free (node);
 
   return entry;
 }

Modified: trunk/info/filesys.c
===================================================================
--- trunk/info/filesys.c        2014-07-05 19:39:16 UTC (rev 5701)
+++ trunk/info/filesys.c        2014-07-06 19:34:32 UTC (rev 5702)
@@ -118,13 +118,11 @@
       fullpath = info_add_extension (0, partial, finfo);
     }
 
-  /* If filename begins with "./" or "../", or if there are intermediate
-     directories, interpret it as relative to current directory.  This may
-     be from the command line, or in the subfiles table of a split file. */
-  else if ((partial[0] == '.'
-           && (IS_SLASH (partial[1])
-               || (partial[1] == '.' && IS_SLASH (partial[2]))))
-          || strchr (partial, '/'))
+  /* If filename has a slash in it (for example, begins with "./" or "../", or
+     if there are intermediate directories) interpret it as relative to current
+     directory.  This may be from the command line, or in the subfiles table of
+     a split file. */
+  else if (HAS_SLASH (partial))
     fullpath = info_add_extension (0, partial, finfo);
   /* If just a simple name element, look for it in the path. */
   else

Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c     2014-07-05 19:39:16 UTC (rev 5701)
+++ trunk/info/info-utils.c     2014-07-06 19:34:32 UTC (rev 5702)
@@ -1251,7 +1251,10 @@
     label_len = read_quoted_string (inptr, ":", 2, &label);
     
   if (label_len == 0)
-    return 0;
+    {
+      free (label);
+      return 0;
+    }
 
   entry->label = label;
   canonicalize_whitespace (entry->label);
@@ -1681,6 +1684,7 @@
           }
 
         text_buffer_free (expansion);
+        free (expansion);
 
         /* Update search. */
         s.buffer = inptr;

Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c   2014-07-05 19:39:16 UTC (rev 5701)
+++ trunk/info/info.c   2014-07-06 19:34:32 UTC (rev 5702)
@@ -786,7 +786,7 @@
   /* If --file was not used and there is a slash in the first non-option
      argument (e.g. "info subdir/file.info"), do not search the dir files
      for a matching entry. */
-  if (!user_filename && argv[0] && strchr (argv[0], '/'))
+  if (!user_filename && argv[0] && HAS_SLASH (argv[0]))
     {
       user_filename = argv[0];
       argv++; /* Advance past first remaining argument. */

Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c  2014-07-05 19:39:16 UTC (rev 5701)
+++ trunk/info/nodes.c  2014-07-06 19:34:32 UTC (rev 5702)
@@ -579,7 +579,7 @@
   int is_fullpath;
   
   /* If full path to the file has been given, we must find it exactly. */
-  is_fullpath = IS_ABSOLUTE (filename) || strchr (filename, '/');
+  is_fullpath = IS_ABSOLUTE (filename) || HAS_SLASH (filename);
 
   /* First try to find the file in our list of already loaded files. */
   if (info_loaded_files)
@@ -666,6 +666,7 @@
 
   file_buffer = info_load_file (fullpath, 0);
 
+  free (fullpath);
   return file_buffer;
 }
 

Modified: trunk/info/t/next-quoted.sh
===================================================================
--- trunk/info/t/next-quoted.sh 2014-07-05 19:39:16 UTC (rev 5701)
+++ trunk/info/t/next-quoted.sh 2014-07-06 19:34:32 UTC (rev 5702)
@@ -19,7 +19,7 @@
 . $t/Init-inter.inc
 
 # Go to a node with colons and commas in its name with "n"
-printf 'n\t\rDq' >$PTY_TYPE
+printf 'n\t\rDq' >$PTY_TYPE &
 $GINFO -f quoting
 
 if ! test -f $GINFO_OUTPUT

Modified: trunk/info/t/split-index.sh
===================================================================
--- trunk/info/t/split-index.sh 2014-07-05 19:39:16 UTC (rev 5701)
+++ trunk/info/t/split-index.sh 2014-07-06 19:34:32 UTC (rev 5702)
@@ -20,7 +20,7 @@
 
 # Follow an index entry in a split file
 
-printf 'ientry text\r\rDq' >$PTY_TYPE
+printf 'ientry text\r\rDq' >$PTY_TYPE &
 $GINFO -f split
 
 if ! test -f $GINFO_OUTPUT

Modified: trunk/info/window.c
===================================================================
--- trunk/info/window.c 2014-07-05 19:39:16 UTC (rev 5701)
+++ trunk/info/window.c 2014-07-06 19:34:32 UTC (rev 5702)
@@ -598,6 +598,7 @@
 
   free (window->line_starts);
   free (window->log_line_no);
+  free (window->line_map.map);
   free (window->modeline);
 
   if (window == active_window)

Modified: trunk/system.h
===================================================================
--- trunk/system.h      2014-07-05 19:39:16 UTC (rev 5701)
+++ trunk/system.h      2014-07-06 19:34:32 UTC (rev 5702)
@@ -175,6 +175,7 @@
 # define FOPEN_WBIN    "wb"
 # define HAVE_DRIVE(n) ((n)[0] && (n)[1] == ':')
 # define IS_SLASH(c)   ((c) == '/' || (c) == '\\')
+# define HAS_SLASH(s)  (strchr ((s), '/') || strchr ((s), '\\'))
 # define IS_ABSOLUTE(n)        (IS_SLASH((n)[0]) || HAVE_DRIVE(n))
 # define SET_BINARY(f)  do {if (!isatty(f)) setmode(f,O_BINARY);} while(0)
 
@@ -183,6 +184,7 @@
 # define FOPEN_RBIN    "r"
 # define FOPEN_WBIN    "w"
 # define IS_SLASH(c)   ((c) == '/')
+# define HAS_SLASH(s)  (strchr ((s), '/'))
 # define HAVE_DRIVE(n) (0)
 # define IS_ABSOLUTE(n)        ((n)[0] == '/')
 # define FILENAME_CMP  strcmp




reply via email to

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