From a97f9e9594225f8078847311fd23b7c339b9f6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eliseo=20Marti=CC=81nez?= Date: Sun, 14 Dec 2014 22:19:23 +0100 Subject: [PATCH] coverity/13696: Unchecked return value: RI. Problem : Unchecked return value (CHECKED_RETURN) @ 2644. Diagnostic : Real issue. Rationale : Other `u_save` invocations are checked, and there's no reason to think this invocation could not fail. Resolution : Check and return if failed (other previous checks in the same function just return, without reporting error, so we just do the same). --- src/nvim/ops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nvim/ops.c b/src/nvim/ops.c index a6dee2be5b..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;