To: vim_dev@googlegroups.com Subject: Patch 8.2.3572 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3572 Problem: Memory leak when closing window and using "multispace" in 'listchars'. Solution: Free the memory. (closes #9071) Files: src/window.c, src/testdir/test_listchars.vim *** ../vim-8.2.3571/src/window.c 2021-08-09 18:59:01.446811234 +0100 --- src/window.c 2021-11-02 20:32:08.035118499 +0000 *************** *** 5041,5046 **** --- 5041,5048 ---- clear_winopt(&wp->w_onebuf_opt); clear_winopt(&wp->w_allbuf_opt); + vim_free(wp->w_lcs_chars.multispace); + #ifdef FEAT_EVAL vars_clear(&wp->w_vars->dv_hashtab); // free all w: variables hash_init(&wp->w_vars->dv_hashtab); *** ../vim-8.2.3571/src/testdir/test_listchars.vim 2021-10-16 17:51:08.047842118 +0100 --- src/testdir/test_listchars.vim 2021-11-02 20:33:42.455749292 +0000 *************** *** 445,451 **** call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$'))) " Setting the global setting to the default value should not impact a window ! " using a local setting split setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:# setglobal listchars&vim --- 445,451 ---- call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$'))) " Setting the global setting to the default value should not impact a window ! " using a local setting. split setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:# setglobal listchars&vim *************** *** 454,460 **** call assert_equal(['^I one two $'], ScreenLines(1, virtcol('$'))) " Setting the local setting to the default value should not impact a window ! " using a global setting set listchars=tab:{.},lead:-,space:=,trail:#,eol:$ split setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:# --- 454,460 ---- call assert_equal(['^I one two $'], ScreenLines(1, virtcol('$'))) " Setting the local setting to the default value should not impact a window ! " using a global setting. set listchars=tab:{.},lead:-,space:=,trail:#,eol:$ split setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:# *************** *** 465,471 **** call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$'))) " Using set in a window with a local setting should change it to use the ! " global setting and also impact other windows using the global setting split setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:# call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$'))) --- 465,471 ---- call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$'))) " Using set in a window with a local setting should change it to use the ! " global setting and also impact other windows using the global setting. split setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:# call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$'))) *************** *** 475,481 **** call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$'))) " Setting invalid value for a local setting should not impact the local and ! " global settings split setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:# let cmd = 'setlocal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x' --- 475,481 ---- call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$'))) " Setting invalid value for a local setting should not impact the local and ! " global settings. split setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:# let cmd = 'setlocal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x' *************** *** 485,491 **** call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$'))) " Setting invalid value for a global setting should not impact the local and ! " global settings split setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:# let cmd = 'setglobal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x' --- 485,491 ---- call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$'))) " Setting invalid value for a global setting should not impact the local and ! " global settings. split setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:# let cmd = 'setglobal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x' *************** *** 494,499 **** --- 494,505 ---- close call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$'))) + " Closing window with local lcs-multispace should not cause a memory leak. + setlocal listchars=multispace:---+ + split + call s:CheckListCharsValue('multispace:---+') + close + %bw! set list& listchars& endfunc *** ../vim-8.2.3571/src/version.c 2021-11-02 20:24:34.980003926 +0000 --- src/version.c 2021-11-02 20:42:46.736681089 +0000 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3572, /**/ -- Facepalm statement #5: "Petrol getting more expensive? Not for me, I'm always tanking for 20 dollars" /// 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 ///