This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author stefanholek
Recipients stefanholek
Date 2011-05-26.12:20:01
SpamBayes Score 3.5061123e-07
Marked as misclassified No
Message-id <1306412402.14.0.859641157612.issue12186@psf.upfronthosting.co.za>
In-reply-to
Content
This is a continuation of issue #9450.

The 'data' element of a history entry may point to an undo list for the entry. When freeing the entry the associated undo list must be freed as well, and 'free(data)' alone does not cut it. I have not found any other use of the 'data' element in all of GNU Readline, so it is safe to assume it is either NULL or an undo list.

diff --git a/rl/readline.c b/rl/readline.c
index 26ac1e2..c8efd5b 100644
--- a/rl/readline.c
+++ b/rl/readline.c
@@ -541,8 +541,18 @@
 static void
 _py_free_history_entry(HIST_ENTRY *entry)
 {
-       histdata_t data = free_history_entry(entry);
-       free(data);
+       UNDO_LIST *undo_list;
+       UNDO_LIST *release;
+
+       /* A history entry may have an undo_list attached */
+       undo_list = (UNDO_LIST *)free_history_entry(entry);
+       while (undo_list) {
+               release = undo_list;
+               undo_list = undo_list->next;
+               if (release->what == UNDO_DELETE)
+                       free(release->text);
+               free(release);
+       }
 }
History
Date User Action Args
2011-05-26 12:20:02stefanholeksetrecipients: + stefanholek
2011-05-26 12:20:02stefanholeksetmessageid: <1306412402.14.0.859641157612.issue12186@psf.upfronthosting.co.za>
2011-05-26 12:20:01stefanholeklinkissue12186 messages
2011-05-26 12:20:01stefanholekcreate