]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1470 v7.4.1470
authorBram Moolenaar <Bram@vim.org>
Wed, 2 Mar 2016 20:09:32 +0000 (21:09 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 2 Mar 2016 20:09:32 +0000 (21:09 +0100)
Problem:    Coverity reports missing restore.
Solution:   Move json_encode() call up.

src/channel.c
src/version.c

index 08271ed80e7b13d3389f0748f7b924a5bcec1c84..824da8a7d192ac5ec9376aece2e2a407d0414042 100644 (file)
@@ -1551,22 +1551,22 @@ may_invoke_callback(channel_T *channel, int part)
     {
        if (buffer != NULL)
        {
-           buf_T       *save_curbuf = curbuf;
-           linenr_T    lnum = buffer->b_ml.ml_line_count;
-
-           /* Append to the buffer */
-           ch_logn(channel, "appending line %d to buffer", (int)lnum + 1);
-
-           curbuf = buffer;
-           u_sync(TRUE);
-           /* ignore undo failure, undo is not very useful here */
-           ignored = u_save(lnum, lnum + 1);
-
            if (msg == NULL)
                /* JSON or JS mode: re-encode the message. */
                msg = json_encode(listtv, ch_mode);
            if (msg != NULL)
            {
+               buf_T       *save_curbuf = curbuf;
+               linenr_T    lnum = buffer->b_ml.ml_line_count;
+
+               /* Append to the buffer */
+               ch_logn(channel, "appending line %d to buffer", (int)lnum + 1);
+
+               curbuf = buffer;
+               u_sync(TRUE);
+               /* ignore undo failure, undo is not very useful here */
+               ignored = u_save(lnum, lnum + 1);
+
                ml_append(lnum, msg, 0, FALSE);
                appended_lines_mark(lnum, 1L);
                curbuf = save_curbuf;
index eef7eebc19f86e7ec96d8c6d1f293325db993638..66a86fb630c9eb1bc496c101663714a721feb540 100644 (file)
@@ -743,6 +743,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1470,
 /**/
     1469,
 /**/