To: vim_dev@googlegroups.com Subject: Patch 8.2.4783 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4783 Problem: Coverity warns for leaking memory. Solution: Use another strategy freeing "theline". Files: src/evalvars.c *** ../vim-8.2.4782/src/evalvars.c 2022-04-17 12:46:50.101294003 +0100 --- src/evalvars.c 2022-04-18 15:41:52.472491270 +0100 *************** *** 684,690 **** list_T * heredoc_get(exarg_T *eap, char_u *cmd, int script_get) { ! char_u *theline; char_u *marker; list_T *l; char_u *p; --- 684,690 ---- list_T * heredoc_get(exarg_T *eap, char_u *cmd, int script_get) { ! char_u *theline = NULL; char_u *marker; list_T *l; char_u *p; *************** *** 776,781 **** --- 776,782 ---- int mi = 0; int ti = 0; + vim_free(theline); theline = eap->getline(NUL, eap->cookie, 0, FALSE); if (theline == NULL) { *************** *** 789,806 **** && STRNCMP(theline, *eap->cmdlinep, marker_indent_len) == 0) mi = marker_indent_len; if (STRCMP(marker, theline + mi) == 0) - { - vim_free(theline); break; - } // If expression evaluation failed in the heredoc, then skip till the // end marker. if (eval_failed) - { - vim_free(theline); continue; - } if (text_indent_len == -1 && *theline != NUL) { --- 790,801 ---- *************** *** 827,833 **** if (str == NULL) { // expression evaluation failed - vim_free(theline); eval_failed = TRUE; continue; } --- 822,827 ---- *************** *** 837,844 **** if (list_append_string(l, str, -1) == FAIL) break; - vim_free(theline); } vim_free(text_indent); if (eval_failed) --- 831,838 ---- if (list_append_string(l, str, -1) == FAIL) break; } + vim_free(theline); vim_free(text_indent); if (eval_failed) *** ../vim-8.2.4782/src/version.c 2022-04-18 15:21:13.344896813 +0100 --- src/version.c 2022-04-18 15:40:55.392505648 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4783, /**/ -- hundred-and-one symptoms of being an internet addict: 26. You check your mail. It says "no new messages." So you check it again. /// 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 ///