Hi

The following command shows a memory leak when writing
the undo file with ACL in Vim-7.3.531 (Linux x86).

$ valgrind --leak-check=yes ./vim -u NONE \
  -c 'set undofile undodir=/tmp|e /tmp/foo|w!|w!|q!'

Each write to file leaks one block. Above example writes
twice so it leaks 2 blocks:

==2765== 272 (56 direct, 216 indirect) bytes in 2 blocks are
definitely lost in loss record 129 of 162
==2765==    at 0x402BE68: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2765==    by 0x493720A: ??? (in /lib/i386-linux-gnu/libacl.so.1.1.0)
==2765==    by 0x814D202: mch_get_acl (os_unix.c:2747)
==2765==    by 0x81C51E2: u_write_undo (undo.c:1536)
==2765==    by 0x80CD931: buf_write (fileio.c:5084)
==2765==    by 0x8099D1B: do_write (ex_cmds.c:2692)
==2765==    by 0x80997D7: ex_write (ex_cmds.c:2501)
==2765==    by 0x80AADD1: do_one_cmd (ex_docmd.c:2668)
==2765==    by 0x80A8699: do_cmdline (ex_docmd.c:1122)
==2765==    by 0x80A7D6D: do_cmdline_cmd (ex_docmd.c:727)
==2765==    by 0x81F5C93: exe_commands (main.c:2842)
==2765==    by 0x81F332A: main (main.c:909)

Attached patch fixes it.

Regards
-- Dominique

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Attachment: fix-leak-acl-undo.c-7.3.531.patch
Description: Binary data

Raspunde prin e-mail lui