forked from aniani/vim
patch 7.4.1959
Problem: Crash when running test_channel.vim on Windows. Solution: Check for NULL pointer result from FormatMessage(). (Christian Brabandt)
This commit is contained in:
parent
eeb50ab522
commit
aad30bbcde
@ -261,7 +261,10 @@ strerror_win32(int eno)
|
|||||||
char_u *ptr;
|
char_u *ptr;
|
||||||
|
|
||||||
if (msgbuf)
|
if (msgbuf)
|
||||||
|
{
|
||||||
LocalFree(msgbuf);
|
LocalFree(msgbuf);
|
||||||
|
msgbuf = NULL;
|
||||||
|
}
|
||||||
FormatMessage(
|
FormatMessage(
|
||||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||||
@ -272,21 +275,22 @@ strerror_win32(int eno)
|
|||||||
(LPTSTR) &msgbuf,
|
(LPTSTR) &msgbuf,
|
||||||
0,
|
0,
|
||||||
NULL);
|
NULL);
|
||||||
/* chomp \r or \n */
|
if (msgbuf != NULL)
|
||||||
for (ptr = (char_u *)msgbuf; *ptr; ptr++)
|
/* chomp \r or \n */
|
||||||
switch (*ptr)
|
for (ptr = (char_u *)msgbuf; *ptr; ptr++)
|
||||||
{
|
switch (*ptr)
|
||||||
case '\r':
|
{
|
||||||
STRMOVE(ptr, ptr + 1);
|
case '\r':
|
||||||
ptr--;
|
STRMOVE(ptr, ptr + 1);
|
||||||
break;
|
ptr--;
|
||||||
case '\n':
|
break;
|
||||||
if (*(ptr + 1) == '\0')
|
case '\n':
|
||||||
*ptr = '\0';
|
if (*(ptr + 1) == '\0')
|
||||||
else
|
*ptr = '\0';
|
||||||
*ptr = ' ';
|
else
|
||||||
break;
|
*ptr = ' ';
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
return msgbuf;
|
return msgbuf;
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
void
|
||||||
channel_buffer_free(buf_T *buf)
|
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)
|
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);
|
EMSG2("E905: received unknown command: %s", cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3186,7 +3190,7 @@ channel_read_json_block(
|
|||||||
{
|
{
|
||||||
more = channel_parse_json(channel, part);
|
more = channel_parse_json(channel, part);
|
||||||
|
|
||||||
/* search for messsage "id" */
|
/* search for message "id" */
|
||||||
if (channel_get_json(channel, part, id, rettv) == OK)
|
if (channel_get_json(channel, part, id, rettv) == OK)
|
||||||
{
|
{
|
||||||
chanpart->ch_block_id = 0;
|
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()".
|
* Common for "ch_sendexpr()" and "ch_sendraw()".
|
||||||
* Returns the channel if the caller should read the response.
|
* 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.
|
* Otherwise returns NULL.
|
||||||
*/
|
*/
|
||||||
channel_T *
|
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,
|
/* 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
|
* 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
|
* NULL the reference. We don't set ch_job_killed, unreferencing the
|
||||||
* job doesn't mean it stops running. */
|
* job doesn't mean it stops running. */
|
||||||
job->jv_channel->ch_job = NULL;
|
job->jv_channel->ch_job = NULL;
|
||||||
|
@ -753,6 +753,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1959,
|
||||||
/**/
|
/**/
|
||||||
1958,
|
1958,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user