[vim/vim] [ASAN LeakSanitizer: detected memory leaks] when testing test_options.vim (Issue #9921)

226 views
Skip to first unread message

KYY

unread,
Mar 10, 2022, 3:57:29 AM3/10/22
to vim/vim, Subscribed

Steps to reproduce

  1. in src/Makefile, disable the the GUI and window-x CONF_OPT_GUI = --disable-gui and CONF_OPT_X = --without-x
  2. then specify the ASAN for the compilation:
CFLAGS = -g3 -fsanitize=address -fno-common -fno-omit-frame-pointer -fPIC
LDFLAGS = -g3 -fsanitize=address -fno-common -fno-omit-frame-pointer -fPIC
  1. compile with make reconfig
  2. after compilation, go to src/testdir and trigger the ASAN LeakSanitizer by testing for test_options.vim:
# at src/testdir
$ VIMRUNTIME=../../runtime  ../vim -f  -u unix.vim -U NONE --noplugin --not-a-term -S runtest.vim test_options.vim --cmd 'au SwapExists * let v:swapchoice = "e"' | LC_ALL=C LANG=C LANGUAGE=C awk '/Executing Test_/{match($0, "Executing Test_[^\\)]*\\)"); print substr($0, RSTART, RLENGTH) "\r"; fflush()}'

Expected behaviour

Expected no memory leak, instead get ASAN memory leak error:

# for test_options.vim
=================================================================
==138337==ERROR: LeakSanitizer: detected memory leaks

Version of Vim

8.2.4407

Environment

OS: Linux Mint 20.3 (Una)
Terminal: xfce4-terminal 0.8.10
$TERM: xterm-256color
Shell: /bin/bash

Logs and stack traces

=================================================================
==138408==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 560 byte(s) in 2 object(s) allocated from:
    #0 0x4993e2 in calloc (src/vim+0x4993e2)
    #1 0x7f5d582a9db7 in _nc_setupterm (/lib/x86_64-linux-gnu/libtinfo.so.6+0x13db7)

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x485614 in strdup (src/vim+0x485614)
    #1 0x7f5d582b14f7 in _nc_trim_sgr0 (/lib/x86_64-linux-gnu/libtinfo.so.6+0x1b4f7)

Indirect leak of 7988 byte(s) in 6 object(s) allocated from:
    #0 0x499589 in realloc (src/vim+0x499589)
    #1 0x7f5d582a72c7 in _nc_doalloc (/lib/x86_64-linux-gnu/libtinfo.so.6+0x112c7)

Indirect leak of 7584 byte(s) in 2 object(s) allocated from:
    #0 0x49926d in malloc (src/vim+0x49926d)
    #1 0x7f5d582a51af  (/lib/x86_64-linux-gnu/libtinfo.so.6+0xf1af)

Indirect leak of 3042 byte(s) in 2 object(s) allocated from:
    #0 0x49926d in malloc (src/vim+0x49926d)
    #1 0x7f5d582afe82 in _nc_read_termtype (/lib/x86_64-linux-gnu/libtinfo.so.6+0x19e82)

Indirect leak of 1510 byte(s) in 2 object(s) allocated from:
    #0 0x49926d in malloc (src/vim+0x49926d)
    #1 0x7f5d582b080b in _nc_read_termtype (/lib/x86_64-linux-gnu/libtinfo.so.6+0x1a80b)

Indirect leak of 992 byte(s) in 2 object(s) allocated from:
    #0 0x4993e2 in calloc (src/vim+0x4993e2)
    #1 0x7f5d582b078b in _nc_read_termtype (/lib/x86_64-linux-gnu/libtinfo.so.6+0x1a78b)

Indirect leak of 992 byte(s) in 2 object(s) allocated from:
    #0 0x49926d in malloc (src/vim+0x49926d)
    #1 0x7f5d582a52d9  (/lib/x86_64-linux-gnu/libtinfo.so.6+0xf2d9)

Indirect leak of 156 byte(s) in 2 object(s) allocated from:
    #0 0x49926d in malloc (src/vim+0x49926d)
    #1 0x7f5d582a51ff  (/lib/x86_64-linux-gnu/libtinfo.so.6+0xf1ff)

Indirect leak of 92 byte(s) in 2 object(s) allocated from:
    #0 0x49926d in malloc (src/vim+0x49926d)
    #1 0x7f5d582a518e  (/lib/x86_64-linux-gnu/libtinfo.so.6+0xf18e)

Indirect leak of 21 byte(s) in 2 object(s) allocated from:
    #0 0x485614 in strdup (src/vim+0x485614)
    #1 0x7f5d582a9e4f in _nc_setupterm (/lib/x86_64-linux-gnu/libtinfo.so.6+0x13e4f)

SUMMARY: AddressSanitizer: 22945 byte(s) leaked in 25 allocation(s).


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9921@github.com>

Christian Brabandt

unread,
Mar 10, 2022, 8:40:45 AM3/10/22
to vim/vim, Subscribed

Those leaks do come not from Vim, but some other libraries. In the CI, libtinfo is ignored when detecting leaks


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9921/1064075497@github.com>

Christian Brabandt

unread,
Mar 10, 2022, 8:41:06 AM3/10/22
to vim/vim, Subscribed

Closed #9921.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/9921/issue_event/6217807216@github.com>

KYY

unread,
Mar 10, 2022, 9:13:52 AM3/10/22
to vim/vim, Subscribed

i see. Thank you for the information!


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9921/1064106757@github.com>

Reply all
Reply to author
Forward
0 new messages