To: vim_dev@googlegroups.com Subject: Patch 9.0.1037 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1037 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. Files: src/vim9class.c *** ../vim-9.0.1036/src/vim9class.c 2022-12-08 20:41:55.433288306 +0000 --- src/vim9class.c 2022-12-08 22:07:24.899674120 +0000 *************** *** 121,128 **** semsg(_(e_command_cannot_be_shortened_str), line); else if (*p == '|' || !ends_excmd2(line, p)) semsg(_(e_trailing_characters_str), p); ! ! success = TRUE; break; } --- 121,128 ---- semsg(_(e_command_cannot_be_shortened_str), line); else if (*p == '|' || !ends_excmd2(line, p)) semsg(_(e_trailing_characters_str), p); ! else ! success = TRUE; break; } *************** *** 190,198 **** // Members are used by the new() function, add them here. cl->class_obj_member_count = objmembers.ga_len; ! cl->class_obj_members = ALLOC_MULT(objmember_T, objmembers.ga_len); if (cl->class_name == NULL ! || cl->class_obj_members == NULL) { vim_free(cl->class_name); vim_free(cl->class_obj_members); --- 190,199 ---- // Members are used by the new() function, add them here. cl->class_obj_member_count = objmembers.ga_len; ! cl->class_obj_members = objmembers.ga_len == 0 ? NULL ! : ALLOC_MULT(objmember_T, objmembers.ga_len); if (cl->class_name == NULL ! || (objmembers.ga_len > 0 && cl->class_obj_members == NULL)) { vim_free(cl->class_name); vim_free(cl->class_obj_members); *** ../vim-9.0.1036/src/version.c 2022-12-08 21:49:09.844530541 +0000 --- src/version.c 2022-12-08 22:02:43.803796791 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1037, /**/ -- God made the integers; all else is the work of Man. -- Kronecker /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///