To: vim_dev@googlegroups.com Subject: Patch 8.1.1186 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1186 Problem: readdir() allocates list twice. Solution: Remove second allocation. Also check for zero length. Files: src/evalfunc.c *** ../vim-8.1.1185/src/evalfunc.c 2019-04-08 20:01:42.877179442 +0200 --- src/evalfunc.c 2019-04-19 15:20:22.221545619 +0200 *************** *** 9324,9333 **** } #endif ! rettv->vval.v_list = list_alloc(); ! if (!failed && rettv->vval.v_list != NULL) { - ++rettv->vval.v_list->lv_refcount; sort_strings((char_u **)ga.ga_data, ga.ga_len); for (i = 0; i < ga.ga_len; i++) { --- 9324,9331 ---- } #endif ! if (!failed && rettv->vval.v_list != NULL && ga.ga_len > 0) { sort_strings((char_u **)ga.ga_data, ga.ga_len); for (i = 0; i < ga.ga_len; i++) { *************** *** 9335,9344 **** list_append_string(rettv->vval.v_list, p, -1); } } ! for (i = 0; i < ga.ga_len; i++) ! vim_free(((char_u **)ga.ga_data)[i]); ! ! ga_clear(&ga); } /* --- 9333,9339 ---- list_append_string(rettv->vval.v_list, p, -1); } } ! ga_clear_strings(&ga); } /* *** ../vim-8.1.1185/src/version.c 2019-04-18 21:08:46.841176544 +0200 --- src/version.c 2019-04-19 15:19:45.857716573 +0200 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1186, /**/ -- "Intelligence has much less practical application than you'd think." -- Scott Adams, Dilbert. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///