mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.0.1037: lalloc(0) error for a class without members
Problem: lalloc(0) error for a class without members. Solution: Don't allocate room for members if there aren't any. Don't create the class if there was an error.
This commit is contained in:
@@ -695,6 +695,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 */
|
||||||
|
/**/
|
||||||
|
1037,
|
||||||
/**/
|
/**/
|
||||||
1036,
|
1036,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -121,8 +121,8 @@ ex_class(exarg_T *eap)
|
|||||||
semsg(_(e_command_cannot_be_shortened_str), line);
|
semsg(_(e_command_cannot_be_shortened_str), line);
|
||||||
else if (*p == '|' || !ends_excmd2(line, p))
|
else if (*p == '|' || !ends_excmd2(line, p))
|
||||||
semsg(_(e_trailing_characters_str), p);
|
semsg(_(e_trailing_characters_str), p);
|
||||||
|
else
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,9 +190,10 @@ ex_class(exarg_T *eap)
|
|||||||
|
|
||||||
// Members are used by the new() function, add them here.
|
// Members are used by the new() function, add them here.
|
||||||
cl->class_obj_member_count = objmembers.ga_len;
|
cl->class_obj_member_count = objmembers.ga_len;
|
||||||
cl->class_obj_members = ALLOC_MULT(objmember_T, objmembers.ga_len);
|
cl->class_obj_members = objmembers.ga_len == 0 ? NULL
|
||||||
|
: ALLOC_MULT(objmember_T, objmembers.ga_len);
|
||||||
if (cl->class_name == NULL
|
if (cl->class_name == NULL
|
||||||
|| cl->class_obj_members == NULL)
|
|| (objmembers.ga_len > 0 && cl->class_obj_members == NULL))
|
||||||
{
|
{
|
||||||
vim_free(cl->class_name);
|
vim_free(cl->class_name);
|
||||||
vim_free(cl->class_obj_members);
|
vim_free(cl->class_obj_members);
|
||||||
|
Reference in New Issue
Block a user