diff options
| author | Nick Neisen <nwneisen@gmail.com> | 2018-05-16 19:17:11 -0600 | 
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2018-05-17 08:48:42 +0200 | 
| commit | b44b533ada401f0e468a07272f3b5d10f78bba5a (patch) | |
| tree | 4fe38c4e7234c1e979eaefaafb421dd1a4b57ec0 /src | |
| parent | 2aa308c6852b7c51caef5dd6dc4e809719ca7a55 (diff) | |
| download | rneovim-b44b533ada401f0e468a07272f3b5d10f78bba5a.tar.gz rneovim-b44b533ada401f0e468a07272f3b5d10f78bba5a.tar.bz2 rneovim-b44b533ada401f0e468a07272f3b5d10f78bba5a.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/ops.c | 5 | 
1 files changed, 3 insertions, 2 deletions
| 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;      }    } | 
