Dominique Pelle wrote:

> I can reproduce a memory leak with Vim-7.2.293 (and older).
> 
> Steps to reproduce:
> 
> 1/ Create the following minimalistic script:
> 
>   $ cat leak.vim
> 
>   function Foo()
>     redraw!
>     return ''
>   endfunction
> 
>   set hlsearch
>   set laststatus=2
>   set statusline=%{Foo()}
> 
> 2/ Start Vim with Valgrind using:
> 
>    $ cd vim7/src
>    $ valgrind --leak-check=yes ./vim \
>        --noplugin \
>        -u leak.vim buffer.c \
>        -c 'exe "normal /to\<CR>"' 2> vg.log
> 
> 3/ Press   n   several times (press 3 times for example) to go to next
>    match several times.
> 
> 4/ Quit Vim with:
> 
>    :q!
> 
> 5/ Observe in vg.log the following memory leaks:
> 
> ==15737== 164 bytes in 4 blocks are definitely lost in loss record 100 of 113
> ==15737==    at 0x402603E: malloc (vg_replace_malloc.c:207)
> ==15737==    by 0x8115C72: lalloc (misc2.c:866)
> ==15737==    by 0x815AAF7: vim_regcomp (regexp.c:1021)
> ==15737==    by 0x81747EA: search_regcomp (search.c:216)
> ==15737==    by 0x817505C: last_pat_prog (search.c:501)
> ==15737==    by 0x816F71E: start_search_hl (screen.c:6590)
> ==15737==    by 0x816488C: update_screen (screen.c:505)
> ==15737==    by 0x80E7C97: main_loop (main.c:1121)
> ==15737==    by 0x80E792D: main (main.c:948)
> 
> One block is leaked when doing the first search with  /to  then
> other blocks are leaked every time you press  n  to go to next
> match.  In above example I pressed  n  3 times so there was 1+3=4
> leaks in total.
> 
> Attached patch fixes it.

Thanks!


-- 
ARTHUR: Old woman!
DENNIS: Man!
ARTHUR: Man.  I'm sorry.  Old man, What knight live in that castle over there?
DENNIS: I'm thirty-seven.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui