static int
write_input_record_buffer(INPUT_RECORD* irEvents, int nLength)
{
- int nCount = 0;
+ int nCount = 0;
+ input_record_buffer_node_T *event_node;
+
while (nCount < nLength)
{
- input_record_buffer.length++;
- input_record_buffer_node_T *event_node =
- malloc(sizeof(input_record_buffer_node_T));
+ event_node = alloc(sizeof(input_record_buffer_node_T));
+ if (event_node == NULL)
+ return -1;
+
event_node->ir = irEvents[nCount++];
event_node->next = NULL;
+
+ input_record_buffer.length++;
if (input_record_buffer.tail == NULL)
{
input_record_buffer.head = event_node;
// events. But, this doesn't work well in the CI test environment. So
// implementing an input_record_buffer instead.
if (input_encoded)
- lpEventsWritten = write_input_record_buffer(&ir, 1);
+ {
+ if ((lpEventsWritten = write_input_record_buffer(&ir, 1)) < 0)
+ {
+ semsg(_(e_out_of_memory), "event");
+ return FALSE;
+ }
+ }
// Set flags to execute the event, ie. like feedkeys mode X.
if (execute)
STRCPY(gettail(vimrun_location), "vimrun.exe");
if (mch_getperm(vimrun_location) >= 0)
{
+ char *p;
+
if (*skiptowhite(vimrun_location) != NUL)
{
// Enclose path with white space in double quotes.
else
STRCPY(gettail(vimrun_location), "vimrun ");
- vimrun_path = (char *)vim_strsave(vimrun_location);
- s_dont_use_vimrun = FALSE;
+ p = (char *)vim_strsave(vimrun_location);
+ if (p != NULL)
+ {
+ vimrun_path = p;
+ s_dont_use_vimrun = FALSE;
+ }
}
else if (executable_exists("vimrun.exe", NULL, TRUE, FALSE))
s_dont_use_vimrun = FALSE;
HANDLE hTo;
WCHAR *to_name;
- to_name = malloc((wcslen(to) + wcslen(substream) + 1) * sizeof(WCHAR));
+ to_name = alloc((wcslen(to) + wcslen(substream) + 1) * sizeof(WCHAR));
+ if (to_name == NULL)
+ return;
+
wcscpy(to_name, to);
wcscat(to_name, substream);
ArglistW = CommandLineToArgvW(GetCommandLineW(), &nArgsW);
if (ArglistW != NULL)
{
- argv = malloc((nArgsW + 1) * sizeof(char *));
+ argv = alloc((nArgsW + 1) * sizeof(char *));
if (argv != NULL)
{
argc = nArgsW;
{
if (used_file_indexes != NULL)
free(used_file_indexes);
- used_file_indexes = malloc(argc * sizeof(int));
+ used_file_indexes = alloc(argc * sizeof(int));
}
if (argvp != NULL)