Bash-4.2 patch 37
[platform/upstream/bash.git] / lib / readline / undo.c
index c2a7851..eb042b2 100644 (file)
@@ -114,7 +114,7 @@ rl_free_undo_list ()
       rl_undo_list = rl_undo_list->next;
 
       if (release->what == UNDO_DELETE)
-       free (release->text);
+       xfree (release->text);
 
       xfree (release);
     }
@@ -139,6 +139,9 @@ _rl_copy_undo_list (head)
 {
   UNDO_LIST *list, *new, *roving, *c;
 
+  if (head == 0)
+    return head;
+
   list = head;
   new = 0;
   while (list)
@@ -191,7 +194,7 @@ rl_do_undo ()
        case UNDO_DELETE:
          rl_point = start;
          rl_insert_text (rl_undo_list->text);
-         free (rl_undo_list->text);
+         xfree (rl_undo_list->text);
          break;
 
        /* Undoing inserts means deleting some text. */