From b44b533ada401f0e468a07272f3b5d10f78bba5a Mon Sep 17 00:00:00 2001 From: Nick Neisen Date: Wed, 16 May 2018 19:17:11 -0600 Subject: coverity/13969: handle u_save() failure Looking at the implementation of u_save suggests that its failure is a normal and expected situation (e.g. if undo isn't allowed for some reason, it will fail). Also (most of) the other calls to u_save() in do_put() return early. --- src/nvim/ops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/nvim/ops.c') diff --git a/src/nvim/ops.c b/src/nvim/ops.c index b39b139f9b..d874768dfc 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -2724,7 +2724,9 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags) // So the 'u' command restores cursor position after ".p, save the cursor // position now (though not saving any text). if (command_start_char == 'a') { - u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1); + if (u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1) == FAIL) { + return; + } } return; } @@ -2742,7 +2744,6 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags) // Autocommands may be executed when saving lines for undo, which may make // y_array invalid. Start undo now to avoid that. if (u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1) == FAIL) { - ELOG("Failed to save undo information"); return; } } -- cgit