diff options
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r-- | src/nvim/ops.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 9f73d40761..931b877a95 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -30,6 +30,7 @@ #include "nvim/fold.h" #include "nvim/getchar.h" #include "nvim/indent.h" +#include "nvim/log.h" #include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memline.h" @@ -2641,7 +2642,10 @@ do_put ( /* Autocommands may be executed when saving lines for undo, which may make * y_array invalid. Start undo now to avoid that. */ - u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1); + if (u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1) == FAIL) { + ELOG(_("Failed to save undo information")); + return; + } if (insert_string != NULL) { y_type = MCHAR; @@ -4483,10 +4487,7 @@ int read_viminfo_register(vir_T *virp, int force) if (set_prev) y_previous = y_current; - for (int i = 0; i < y_current->y_size; i++) { - free(y_current->y_array[i]); - } - free(y_current->y_array); + free_yank_all(); array = xmalloc(limit * sizeof(char_u *)); str = skipwhite(skiptowhite(str)); @@ -4515,7 +4516,6 @@ int read_viminfo_register(vir_T *virp, int force) if (do_it) { if (size == 0) { free(array); - y_current->y_array = NULL; } else if (size < limit) { y_current->y_array = xrealloc(array, size * sizeof(char_u *)); } else { |