bug-readline
[Top][All Lists]
Advanced

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

Memory leak when readline references history


From: Bruce Frost
Subject: Memory leak when readline references history
Date: Mon, 4 Apr 2022 14:07:58 -0700
User-agent: Mutt/1.10.1 (2018-07-13)

My simple application calls readline with history
enabled and always adds the input to the history.
If after entering a line, I use up-arrow to get
the previously entered line and press enter,
a memory leak occurs with the backtrace:

In this output, the <up arrow> <Enter> was done
twice resulting in two instances with the same backtrace.

==14026==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 2 object(s) allocated from:
    #0 0x7f13711e8110 in malloc (/usr/lib64/libasan.so.4+0xdc110)
    #1 0x7f136c2550f9 in xmalloc ../../readline-8.1/xmalloc.c:59
    #2 0x7f136c22da89 in alloc_undo_entry ../../readline-8.1/undo.c:77
    #3 0x7f136c22dbd8 in rl_add_undo ../../readline-8.1/undo.c:94
    #4 0x7f136c2359c9 in rl_insert_text ../../readline-8.1/text.c:112
    #5 0x7f136c239254 in _rl_insert_char ../../readline-8.1/text.c:902
    #6 0x7f136c239608 in rl_insert ../../readline-8.1/text.c:951
    #7 0x7f136c1dee0b in _rl_dispatch_subseq ../../readline-8.1/readline.c:887
    #8 0x7f136c1de97b in _rl_dispatch ../../readline-8.1/readline.c:833
    #9 0x7f136c1dde9a in readline_internal_char 
../../readline-8.1/readline.c:645
    #10 0x7f136c1de1dc in readline_internal_charloop 
../../readline-8.1/readline.c:694
    #11 0x7f136c1de1ff in readline_internal ../../readline-8.1/readline.c:706
    #12 0x7f136c1dd4ed in readline ../../readline-8.1/readline.c:385
    #13 0x500271 in xxx_readline ../../xxx/src/files/xxxreadline.c:199
    #14 0x565564 in xxxrawinput ../../xxx/src/input/xxxinput.c:499
    #15 0x565e1e in xxxinput ../../xxx/src/input/xxxinput.c:649
    #16 0x56fb99 in xxxexecmode ../../xxx/src/main/xxxmain.c:1569
    #17 0x571464 in xxxdispatcher ../../xxx/src/main/xxxmain.c:1917
    #18 0x573434 in main ../../xxx/src/main/xxxmain.c:2343
    #19 0x7f136fc372bc in __libc_start_main (/lib64/libc.so.6+0x352bc)

SUMMARY: AddressSanitizer: 64 byte(s) leaked in 2 allocation(s).



reply via email to

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