bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory leaks in _nc_init_termtype


From: Thomas Dickey
Subject: Re: Memory leaks in _nc_init_termtype
Date: Fri, 22 Nov 2024 03:59:24 -0500

On Fri, Nov 22, 2024 at 02:20:04AM +0000, TU Haoxin wrote:
> Hi,
> 
> A memory leak is found when `tic` processes an input.
> 
> ```
> $./tic input
> "input", line 2, col 232: whitespace in name or alias field
> "input", line 2, col 232: invalid entry name "O
>                                                
> 34UPRPFRL5USO5DBUO269MQWWDEZKI6WZAK75AS65EILCABZ3XE62NUDPQ43KIR7SUBL1G51TA5J8NO8YPBYLCF8FKB1OZOI0LWMA4Z87XFY2RPS09Q4L78DZZ6LNR67AXXEGCXSIF5EIQIQLY088RQ0888BKZCCCHJEM65ZD8VBYUTZKZVN0A0Q5HN0WFXXO61TTT8SJ54VHEWXUGKIC0Q1GTOMNCPD8PUFQO"
> 
> =================================================================
> ==16876==ERROR: LeakSanitizer: detected memory leaks
> 
> Direct leak of 3312 byte(s) in 1 object(s) allocated from:
>     #0 0x7ffff6ef6b40 in __interceptor_malloc 
> (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
>     #1 0x5555555ca044 in _nc_init_termtype 
> ../../ncurses/tinfo/read_entry.c:245
>     #2 0x5555555f6285 in _nc_init_entry ../../ncurses/tinfo/alloc_entry.c:81
>     #3 0x5555555dfa4f in _nc_parse_entry ../../ncurses/tinfo/parse_entry.c:304
>     #4 0x5555555d68a9 in _nc_read_entry_source 
> ../../ncurses/tinfo/comp_parse.c:236
>     #5 0x55555558fe94 in main ../../progs/tic.c:983
>     #6 0x7ffff6a48c86 in __libc_start_main 
> (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
> 
> Direct leak of 156 byte(s) in 1 object(s) allocated from:
>     #0 0x7ffff6ef6b40 in __interceptor_malloc 
> (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
>     #1 0x5555555c9fda in _nc_init_termtype 
> ../../ncurses/tinfo/read_entry.c:243
>     #2 0x5555555f6285 in _nc_init_entry ../../ncurses/tinfo/alloc_entry.c:81
>     #3 0x5555555dfa4f in _nc_parse_entry ../../ncurses/tinfo/parse_entry.c:304
>     #4 0x5555555d68a9 in _nc_read_entry_source 
> ../../ncurses/tinfo/comp_parse.c:236
>     #5 0x55555558fe94 in main ../../progs/tic.c:983
>     #6 0x7ffff6a48c86 in __libc_start_main 
> (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
> 
> Direct leak of 44 byte(s) in 1 object(s) allocated from:
>     #0 0x7ffff6ef6b40 in __interceptor_malloc 
> (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
>     #1 0x5555555c9f70 in _nc_init_termtype 
> ../../ncurses/tinfo/read_entry.c:241
>     #2 0x5555555f6285 in _nc_init_entry ../../ncurses/tinfo/alloc_entry.c:81
>     #3 0x5555555dfa4f in _nc_parse_entry ../../ncurses/tinfo/parse_entry.c:304
>     #4 0x5555555d68a9 in _nc_read_entry_source 
> ../../ncurses/tinfo/comp_parse.c:236
>     #5 0x55555558fe94 in main ../../progs/tic.c:983
>     #6 0x7ffff6a48c86 in __libc_start_main 
> (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
> 
> SUMMARY: AddressSanitizer: 3512 byte(s) leaked in 3 allocation(s).
> ```

I don't get this with a quick check, using current code or 6.5 release.
(see attached)
 
> Building command: `CC=gcc CFLAGS="-fsanitize=address -g" ../configure
> Compiler version: `gcc-7.5.0`

gcc (Debian 12.2.0-14) 12.2.0

> Ncurses version: `6.5` (I also tested with v6.4 and they behave the same)

> System: `ubuntu 18.04`

Ubuntu 18's past end-of-life and Ubuntu itself is off topic in any case

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net

Attachment: valgrind.log
Description: Text document

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]