Hi Dominique,
On Sun, Aug 28, 2016 at 1:56 AM, Dominique Pellé
<[email protected]> wrote:
> Hi
>
> I see a memory leak in Vim-7.4.2275 which can be
> reproduced by:
>
> $ valgrind --leak-check=yes --num-callers=50 \
> vim -u NONE -N \
> -c 'sign define Sign text=x' \
> -c 'exe "sign place 1 line=3 name=Sign buffer=" . bufnr("%")' \
> -c 'echo getbufinfo()' \
> -c q 2> log
>
Can you try the attached patch?
Thanks,
Yegappan
>
> And log file contains:
>
> ==11611== Memcheck, a memory error detector
> ==11611== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
> ==11611== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
> ==11611== Command: ./vim -u NONE -N -c sign\ define\ Sign\ text=x -c
> exe\ "sign\ place\ 1\ line=3\ name=Sign\ buffer="\ .\ bufnr("%") -c
> echo\ getbufinfo()
> ==11611==
> ==11611==
> ==11611== HEAP SUMMARY:
> ==11611== in use at exit: 51,696 bytes in 868 blocks
> ==11611== total heap usage: 11,596 allocs, 10,728 frees, 1,002,877
> bytes allocated
> ==11611==
> ==11611== 5 bytes in 1 blocks are definitely lost in loss record 8 of 125
> ==11611== at 0x402C19C: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
> ==11611== by 0x810CA44: lalloc (misc2.c:920)
> ==11611== by 0x810D32C: alloc (misc2.c:818)
> ==11611== by 0x810D32C: vim_strsave (misc2.c:1263)
> ==11611== by 0x8092058: get_buffer_signs (evalfunc.c:3908)
> ==11611== by 0x8092058: get_buffer_info (evalfunc.c:3964)
> ==11611== by 0x8092058: f_getbufinfo (evalfunc.c:4029)
> ==11611== by 0x809191E: call_internal_func (evalfunc.c:997)
> ==11611== by 0x81C3F1C: call_func (userfunc.c:1372)
> ==11611== by 0x81C506B: get_func_tv (userfunc.c:455)
> ==11611== by 0x8078753: eval7 (eval.c:4343)
> ==11611== by 0x807886D: eval6 (eval.c:3977)
> ==11611== by 0x8078B77: eval5 (eval.c:3793)
> ==11611== by 0x8079909: eval4 (eval.c:3492)
> ==11611== by 0x8079909: eval3 (eval.c:3409)
> ==11611== by 0x8079A9F: eval2 (eval.c:3341)
> ==11611== by 0x8079A9F: eval1 (eval.c:3269)
> ==11611== by 0x807B9EC: ex_echo (eval.c:8175)
> ==11611== by 0x80B0FD4: do_one_cmd (ex_docmd.c:2967)
> ==11611== by 0x80B0FD4: do_cmdline (ex_docmd.c:1110)
> ==11611== by 0x80B4CA1: do_cmdline_cmd (ex_docmd.c:715)
> ==11611== by 0x81E2041: exe_commands (main.c:2896)
> ==11611== by 0x81E2041: vim_main2 (main.c:781)
> ==11611== by 0x804E03B: main (main.c:415)
>
> Running ":echo getbufinfo()" N times results in N blocks
> being leaked.
>
> Vim was configured with:
> $ ./configure --with-features=huge --enable-gui=none
> And EXITFREE was define in src/Makefile.
>
> 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
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 7ccf524..769532b 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3905,8 +3905,7 @@ get_buffer_signs(buf_T *buf, list_T *l)
{
dict_add_nr_str(d, "id", sign->id, NULL);
dict_add_nr_str(d, "lnum", sign->lnum, NULL);
- dict_add_nr_str(d, "name", 0L,
- vim_strsave(sign_typenr2name(sign->typenr)));
+ dict_add_nr_str(d, "name", 0L, sign_typenr2name(sign->typenr));
list_append_dict(l, d);
}