Skip to content

Commit 289a905

Browse files
committed
patch 7.4.1470
Problem: Coverity reports missing restore. Solution: Move json_encode() call up.
1 parent 42bc6dd commit 289a905

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

src/channel.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,22 +1551,22 @@ may_invoke_callback(channel_T *channel, int part)
15511551
{
15521552
if (buffer != NULL)
15531553
{
1554-
buf_T *save_curbuf = curbuf;
1555-
linenr_T lnum = buffer->b_ml.ml_line_count;
1556-
1557-
/* Append to the buffer */
1558-
ch_logn(channel, "appending line %d to buffer", (int)lnum + 1);
1559-
1560-
curbuf = buffer;
1561-
u_sync(TRUE);
1562-
/* ignore undo failure, undo is not very useful here */
1563-
ignored = u_save(lnum, lnum + 1);
1564-
15651554
if (msg == NULL)
15661555
/* JSON or JS mode: re-encode the message. */
15671556
msg = json_encode(listtv, ch_mode);
15681557
if (msg != NULL)
15691558
{
1559+
buf_T *save_curbuf = curbuf;
1560+
linenr_T lnum = buffer->b_ml.ml_line_count;
1561+
1562+
/* Append to the buffer */
1563+
ch_logn(channel, "appending line %d to buffer", (int)lnum + 1);
1564+
1565+
curbuf = buffer;
1566+
u_sync(TRUE);
1567+
/* ignore undo failure, undo is not very useful here */
1568+
ignored = u_save(lnum, lnum + 1);
1569+
15701570
ml_append(lnum, msg, 0, FALSE);
15711571
appended_lines_mark(lnum, 1L);
15721572
curbuf = save_curbuf;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ static char *(features[]) =
743743

744744
static int included_patches[] =
745745
{ /* Add new patch number below this line */
746+
/**/
747+
1470,
746748
/**/
747749
1469,
748750
/**/

0 commit comments

Comments
 (0)