Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unlet v:["count"] leaks memory #1497

Closed
ZyX-I opened this issue Feb 20, 2017 · 1 comment · Fixed by neovim/neovim#8141
Closed

unlet v:["count"] leaks memory #1497

ZyX-I opened this issue Feb 20, 2017 · 1 comment · Fixed by neovim/neovim#8141

Comments

@ZyX-I
Copy link

ZyX-I commented Feb 20, 2017

To reproduce the leak it is enough to compile Vim with address sanitizing enabled (without disabling memory leak detection) and running vim -i NONE -u NONE --cmd 'unlet v:["count"]' --cmd cq (actually, any DI_FLAGS_RO variable should do, I initially found this when creating test suite for my version of b:changedtick patch).

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 20 2017 23:00:21)
Included patches: 1-342
Compiled by root@zyx-desktop
Huge version with X11-Motif GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     +tcl
+balloon_eval    +folding         +mouse_xterm     +termguicolors
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
+clientserver    +insert_expand   +packages        +toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      +python3/dyn     +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua/dyn         +rightleft       +writebackup
+diff            +menu            +ruby            +X11
+digraphs        +mksession       +scrollbind      +xfontset
-dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     +xpm
+emacs_tags      +mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          
+farsi           +mouse_netterm   +tag_binary      
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MOTIF -DFUNCPROTO=15 -DNARROWPROTO    -fsanitize=address,undefined -DEXITFREE  -O0 -g -DEXITFREE  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L. -Wl,-O1 -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--no-undefined -Wl,-E   -fsanitize=address,undefined  -L/usr/local/lib -Wl,--as-needed -o vim  -lXp -lXmu -lXext -lXm -lXt -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -ldl  -lm -lncurses -lelf -lnsl    -lacl -lattr -lgpm   -Wl,-E -Wl,-O1 -Wl,--as-needed  -L/usr/lib64/perl5/5.22.3/x86_64-linux/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc   -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby21 -lpthread -lgmp -ldl -lcrypt -lm  -L/usr/lib64    
@ZyX-I
Copy link
Author

ZyX-I commented Feb 20, 2017

Leak log itself:

=================================================================
==6776==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x4f5518 in __interceptor_malloc /var/tmp/portage/sys-devel/llvm-3.8.1-r2/work/llvm-3.8.1.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:52
    #1 0xc31798 in lalloc /home/zyx/a.a/Proj/c/vim-upstream/src/misc2.c:942:21
    #2 0xc316e7 in alloc /home/zyx/a.a/Proj/c/vim-upstream/src/misc2.c:840:13
    #3 0x6f09ad in get_string_tv /home/zyx/a.a/Proj/c/vim-upstream/src/eval.c:4843:12
    #4 0x6ed7e2 in eval7 /home/zyx/a.a/Proj/c/vim-upstream/src/eval.c:4227:21
    #5 0x6eaa55 in eval6 /home/zyx/a.a/Proj/c/vim-upstream/src/eval.c:3966:9
    #6 0x6e8c29 in eval5 /home/zyx/a.a/Proj/c/vim-upstream/src/eval.c:3782:9
    #7 0x6e4241 in eval4 /home/zyx/a.a/Proj/c/vim-upstream/src/eval.c:3481:9
    #8 0x6e3863 in eval3 /home/zyx/a.a/Proj/c/vim-upstream/src/eval.c:3398:9
    #9 0x696b53 in eval2 /home/zyx/a.a/Proj/c/vim-upstream/src/eval.c:3330:9
    #10 0x67d772 in eval1 /home/zyx/a.a/Proj/c/vim-upstream/src/eval.c:3258:9
    #11 0x66edd3 in get_lval /home/zyx/a.a/Proj/c/vim-upstream/src/eval.c:1940:7
    #12 0x69006f in ex_unletlock /home/zyx/a.a/Proj/c/vim-upstream/src/eval.c:2700:13
    #13 0x68fda2 in ex_unlet /home/zyx/a.a/Proj/c/vim-upstream/src/eval.c:2660:5
    #14 0x882e8c in do_one_cmd /home/zyx/a.a/Proj/c/vim-upstream/src/ex_docmd.c:2981:2
    #15 0x86278d in do_cmdline /home/zyx/a.a/Proj/c/vim-upstream/src/ex_docmd.c:1120:17
    #16 0x867d45 in do_cmdline_cmd /home/zyx/a.a/Proj/c/vim-upstream/src/ex_docmd.c:720:12
    #17 0x184230c in exe_pre_commands /home/zyx/a.a/Proj/c/vim-upstream/src/main.c:2874:6
    #18 0x183f839 in vim_main2 /home/zyx/a.a/Proj/c/vim-upstream/src/main.c:436:5
    #19 0x1831eea in main /home/zyx/a.a/Proj/c/vim-upstream/src/main.c:415:12
    #20 0x7f9e613237ef in __libc_start_main (/lib64/libc.so.6+0x207ef)

SUMMARY: AddressSanitizer: 6 byte(s) leaked in 1 allocation(s).

ZyX-I added a commit to ZyX-I/neovim that referenced this issue Feb 20, 2017
ZyX-I added a commit to ZyX-I/neovim that referenced this issue Feb 23, 2017
chrisbra pushed a commit to chrisbra/vim that referenced this issue Mar 25, 2017
Problem:    Unlet command leaks memory. (Nikolai Pavlov)
Solution:   Free the memory on error. (closes vim#1497)
desvp pushed a commit to desvp/vim that referenced this issue May 30, 2017
Problem:    Unlet command leaks memory. (Nikolai Pavlov)
Solution:   Free the memory on error. (closes vim#1497)
ckelsel added a commit to ckelsel/neovim that referenced this issue Mar 17, 2018
Problem:    Unlet command leaks memory. (Nikolai Pavlov)
Solution:   Free the memory on error. (closes vim/vim#1497)

vim/vim@49439c4
justinmk pushed a commit to neovim/neovim that referenced this issue Mar 17, 2018
Problem:    Unlet command leaks memory. (Nikolai Pavlov)
Solution:   Free the memory on error. (closes vim/vim#1497)
vim/vim@49439c4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant