summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-06-26 17:31:03 +0200
committerBram Moolenaar <Bram@vim.org>2016-06-26 17:31:03 +0200
commitaad30bbcde2b268e2fffb6fd1443f27ebda9d1ff (patch)
treee5e80755fb59ebe28ab5889cf4ef8e13253fe332
parenteeb50ab5228c5c09743a9c2b907c3634c0146e84 (diff)
patch 7.4.1959v7.4.1959
Problem: Crash when running test_channel.vim on Windows. Solution: Check for NULL pointer result from FormatMessage(). (Christian Brabandt)
-rw-r--r--src/channel.c44
-rw-r--r--src/version.c2
2 files changed, 26 insertions, 20 deletions
diff --git a/src/channel.c b/src/channel.c
index 9a98c3a6c2..50028c83d1 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -261,7 +261,10 @@ strerror_win32(int eno)
char_u *ptr;
if (msgbuf)
+ {
LocalFree(msgbuf);
+ msgbuf = NULL;
+ }
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
@@ -272,21 +275,22 @@ strerror_win32(int eno)
(LPTSTR) &msgbuf,
0,
NULL);
- /* chomp \r or \n */
- for (ptr = (char_u *)msgbuf; *ptr; ptr++)
- switch (*ptr)
- {
- case '\r':
- STRMOVE(ptr, ptr + 1);
- ptr--;
- break;
- case '\n':
- if (*(ptr + 1) == '\0')
- *ptr = '\0';
- else
- *ptr = ' ';
- break;
- }
+ if (msgbuf != NULL)
+ /* chomp \r or \n */
+ for (ptr = (char_u *)msgbuf; *ptr; ptr++)
+ switch (*ptr)
+ {
+ case '\r':
+ STRMOVE(ptr, ptr + 1);
+ ptr--;
+ break;
+ case '\n':
+ if (*(ptr + 1) == '\0')
+ *ptr = '\0';
+ else
+ *ptr = ' ';
+ break;
+ }
return msgbuf;
}
#endif
@@ -1436,7 +1440,7 @@ channel_write_in(channel_T *channel)
}
/*
- * Handle buffer "buf" beeing freed, remove it from any channels.
+ * Handle buffer "buf" being freed, remove it from any channels.
*/
void
channel_buffer_free(buf_T *buf)
@@ -2194,7 +2198,7 @@ channel_exe_cmd(channel_T *channel, int part, typval_T *argv)
}
else if (p_verbose > 2)
{
- ch_errors(channel, "Receved unknown command: %s", (char *)cmd);
+ ch_errors(channel, "Received unknown command: %s", (char *)cmd);
EMSG2("E905: received unknown command: %s", cmd);
}
}
@@ -3186,7 +3190,7 @@ channel_read_json_block(
{
more = channel_parse_json(channel, part);
- /* search for messsage "id" */
+ /* search for message "id" */
if (channel_get_json(channel, part, id, rettv) == OK)
{
chanpart->ch_block_id = 0;
@@ -3426,7 +3430,7 @@ channel_send(channel_T *channel, int part, char_u *buf, char *fun)
/*
* Common for "ch_sendexpr()" and "ch_sendraw()".
* Returns the channel if the caller should read the response.
- * Sets "part_read" to the the read fd.
+ * Sets "part_read" to the read fd.
* Otherwise returns NULL.
*/
channel_T *
@@ -4299,7 +4303,7 @@ job_free_contents(job_T *job)
{
/* The link from the channel to the job doesn't count as a reference,
* thus don't decrement the refcount of the job. The reference from
- * the job to the channel does count the refrence, decrement it and
+ * the job to the channel does count the reference, decrement it and
* NULL the reference. We don't set ch_job_killed, unreferencing the
* job doesn't mean it stops running. */
job->jv_channel->ch_job = NULL;
diff --git a/src/version.c b/src/version.c
index 8d0e0697d3..28bd6594c6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1959,
+/**/
1958,
/**/
1957,