vim seems to be leaking memory when doing ":so %" with "syntax on" setting.

Steps to reproduce:

1/ create a simple script as follows:

$ cat leak.vim
" leaks memory when doing ":so %" while this file is loaded in vim
syntax on

2/ start vim

$ valgrind --leak-check=yes vim -u NONE -U NONE leak.vim 2> vg.log

3/ in vim, source the current buffer (leak.vim), then quit

:so %
:q

4/ observe that valgrind reports a memory leak

==18415== 22 bytes in 4 blocks are definitely lost in loss record 2 of 15
==18415==    at 0x4021620: malloc (vg_replace_malloc.c:149)
==18415==    by 0x8102F4C: lalloc (misc2.c:857)
==18415==    by 0x8102E6E: alloc (misc2.c:756)
==18415==    by 0x818C3B1: get_id_list (syntax.c:5761)
==18415==    by 0x81898E6: get_syn_options (syntax.c:4338)
==18415==    by 0x818A5E6: syn_cmd_region (syntax.c:4785)
==18415==    by 0x818C84A: ex_syntax (syntax.c:5974)
==18415==    by 0x809B897: do_one_cmd (ex_docmd.c:2621)
==18415==    by 0x80990FC: do_cmdline (ex_docmd.c:1099)
==18415==    by 0x80973A1: do_source (ex_cmds2.c:3054)
==18415==    by 0x8189DBF: syn_cmd_include (syntax.c:4494)
==18415==    by 0x818C84A: ex_syntax (syntax.c:5974)

Whenever Ex command ":so %" is run, with "syntax on" in script,
4 more blocks of memory leak, i.e.:

- If I do ":so %" once, I see:
  22 bytes in 4 blocks are definitely lost in loss record 2 of 15
- If I do ":so %" twice, I see:
  44 bytes in 8 blocks are definitely lost in loss record 11 of 15
- I I do ": so %" three times, I see:
  66 bytes in 12 blocks are definitely lost in loss record 10 of 15
- etc.

I built vim-7.1.135 on Linux with:
- configure --with-features=huge
- changed src/Makefile to compile without optimisation (-O0)
- changed src/Makefile to enable PROFILE_CFLAGS = -DEXITFREE

I don't have a patch as I am unsure where it should be freed.

-- Dominique

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

Raspunde prin e-mail lui