Dear Developers,
I found a memory leak, detailed system information and build configuration is as follows, the poc is in the mail attachment.
## System info
Ubuntu X64, gcc (Ubuntu 5.5.0-12ubuntu1), ncurses (latest master label v6_2_20200801)
## Configure
CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" ./configure --enable-static
## Command line
./progs/tic -o /tmp @@
## AddressSanitizer output
```
=================================================================
==32479==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1024 byte(s) in 1 object(s) allocated from:
#0 0x4dec48 in __interceptor_malloc /home/seviezhou/llvm-6.0.0/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:88
#1 0x57eaee in _nc_resolve_uses2 /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/comp_parse.c:470:7
#2 0x517aed in main /home/seviezhou/ncurses-snapshots/progs/../progs/tic.c:971:7
#3 0x7f50aef8383f in __libc_start_main /build/glibc-e6zv40/glibc-2.23/csu/../csu/libc-start.c:291
Indirect leak of 3312 byte(s) in 1 object(s) allocated from:
#0 0x4dee60 in calloc /home/seviezhou/llvm-6.0.0/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97
#1 0x566fae in _nc_read_termtype /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:358:25
#2 0x56ab65 in _nc_read_file_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:567:18
#3 0x56c7f7 in _nc_read_tic_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:822:9
#4 0x56b20f in _nc_read_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:866:13
#5 0x57eab7 in _nc_resolve_uses2 /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/comp_parse.c:466:7
#6 0x517aed in main /home/seviezhou/ncurses-snapshots/progs/../progs/tic.c:971:7
#7 0x7f50aef8383f in __libc_start_main /build/glibc-e6zv40/glibc-2.23/csu/../csu/libc-start.c:291
Indirect leak of 392 byte(s) in 1 object(s) allocated from:
#0 0x4dec48 in __interceptor_malloc /home/seviezhou/llvm-6.0.0/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:88
#1 0x566632 in _nc_read_termtype /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:319:21
#2 0x56ab65 in _nc_read_file_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:567:18
#3 0x56c7f7 in _nc_read_tic_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:822:9
#4 0x56b20f in _nc_read_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:866:13
#5 0x57eab7 in _nc_resolve_uses2 /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/comp_parse.c:466:7
#6 0x517aed in main /home/seviezhou/ncurses-snapshots/progs/../progs/tic.c:971:7
#7 0x7f50aef8383f in __libc_start_main /build/glibc-e6zv40/glibc-2.23/csu/../csu/libc-start.c:291
Indirect leak of 78 byte(s) in 1 object(s) allocated from:
#0 0x4dee60 in calloc /home/seviezhou/llvm-6.0.0/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97
#1 0x566d83 in _nc_read_termtype /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:352:26
#2 0x56ab65 in _nc_read_file_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:567:18
#3 0x56c7f7 in _nc_read_tic_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:822:9
#4 0x56b20f in _nc_read_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:866:13
#5 0x57eab7 in _nc_resolve_uses2 /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/comp_parse.c:466:7
#6 0x517aed in main /home/seviezhou/ncurses-snapshots/progs/../progs/tic.c:971:7
#7 0x7f50aef8383f in __libc_start_main /build/glibc-e6zv40/glibc-2.23/csu/../csu/libc-start.c:291
Indirect leak of 44 byte(s) in 1 object(s) allocated from:
#0 0x4dee60 in calloc /home/seviezhou/llvm-6.0.0/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97
#1 0x566a6f in _nc_read_termtype /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:337:26
#2 0x56ab65 in _nc_read_file_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:567:18
#3 0x56c7f7 in _nc_read_tic_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:822:9
#4 0x56b20f in _nc_read_entry /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/read_entry.c:866:13
#5 0x57eab7 in _nc_resolve_uses2 /home/seviezhou/ncurses-snapshots/ncurses/../ncurses/./tinfo/comp_parse.c:466:7
#6 0x517aed in main /home/seviezhou/ncurses-snapshots/progs/../progs/tic.c:971:7
#7 0x7f50aef8383f in __libc_start_main /build/glibc-e6zv40/glibc-2.23/csu/../csu/libc-start.c:291
SUMMARY: AddressSanitizer: 4850 byte(s) leaked in 5 allocation(s).
```