texinfo-commits
[Top][All Lists]
Advanced

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

[5829] fix memory leaks for index-apropos


From: Gavin D. Smith
Subject: [5829] fix memory leaks for index-apropos
Date: Tue, 16 Sep 2014 18:11:43 +0000

Revision: 5829
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5829
Author:   gavin
Date:     2014-09-16 18:11:42 +0000 (Tue, 16 Sep 2014)
Log Message:
-----------
fix memory leaks for index-apropos

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/indices.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-09-15 15:46:22 UTC (rev 5828)
+++ trunk/ChangeLog     2014-09-16 18:11:42 UTC (rev 5829)
@@ -1,3 +1,12 @@
+2014-09-16  Gavin Smith  <address@hidden>
+
+       * info/indices.c (info_index_apropos): Mark apropos node with
+       N_Unstored.
+       (info_indices_of_file_buffer): Free index_index variable before
+       overwriting it.
+       (apropos_in_all_indices): Free return value of get_dir_node before
+       returning.
+
 2014-09-15  Gavin Smith  <address@hidden>
 
        * doc/info-stnd.text (Scrolling Commands): PageUp and PageDown can

Modified: trunk/info/indices.c
===================================================================
--- trunk/info/indices.c        2014-09-15 15:46:22 UTC (rev 5828)
+++ trunk/info/indices.c        2014-09-16 18:11:42 UTC (rev 5829)
@@ -170,6 +170,7 @@
 
   /* Store result so that if we call do_info_index_search later, it
      will be set. */
+  free (index_index);
   index_index = result;
   return result;
 }
@@ -203,9 +204,8 @@
   if (!initial_index_filename ||
       (FILENAME_CMP (initial_index_filename, fb->filename) != 0))
     {
-      free (index_index);
       window_message_in_echo_area (_("Finding index entries..."));
-      index_index = info_indices_of_file_buffer (fb);
+      info_indices_of_file_buffer (fb); /* Sets index_index. */
     }
 
   /* If there is no index, quit now. */
@@ -504,7 +504,10 @@
     dir_menu = dir_node->references;
 
   if (!dir_menu)
-    return NULL;
+    {
+      free (dir_node);
+      return NULL;
+    }
 
   /* For every menu item in DIR, get the associated file buffer and
      read the indices of that file buffer.  Gather all of the indices into
@@ -576,6 +579,7 @@
       free (all_indices);
       all_indices = apropos_list;
     }
+  free (dir_node);
   return all_indices;
 }
 
@@ -642,6 +646,7 @@
 
       add_gcable_pointer (apropos_node->contents);
       name_internal_node (apropos_node, xstrdup (apropos_list_nodename));
+      apropos_node->flags |= N_Unstored;
 
       /* Find/Create a window to contain this node. */
       {




reply via email to

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