bug-readline
[Top][All Lists]
Advanced

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

[Bug-readline] readline 8.0 memory leak


From: lessbug
Subject: [Bug-readline] readline 8.0 memory leak
Date: Thu, 7 Mar 2019 19:55:46 +0800

Hi, I found readline some memory leak, please fix it, thanks a lot.

Respectfully,

lessbug

 

----------------------------

  • The version number and release status of Readline (e.g., 4.2-release)
  • -- download from ftp://ftp.gnu.org/gnu/readline/readline-8.0.tar.gz

  • The machine and OS that it is running on
  • -- CentOS Linux release 7.4.1708 (Core)

  • A list of the compilation flags or the contents of `config.h', if appropriate
  • -- attachment config.h

  • a description of the bug
  • -- memory leak

  • a recipe for recreating the bug reliably
  • -- valgrind --leak-check=full ./test-demo

    -- test-demo is my demo used libreadline.a libhistory.a

  • a fix for the bug if you have one!
  • -- not fixed
     
     
     valgrind --leak-check=full ./test-demo
    ==77924== Memcheck, a memory error detector
    ==77924== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
    ==77924== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
    ==77924== Command: ./test-demo
    ==77924==
    demo> a
    No commands match 'a'
    demo> test qu
    para(0)=qu
    demo> quit
    ==77924==
    ==77924== HEAP SUMMARY:
    ==77924==     in use at exit: 83,519 bytes in 140 blocks
    ==77924==   total heap usage: 442 allocs, 302 frees, 101,844 bytes allocated
    ==77924==
    ==77924== 2 bytes in 1 blocks are definitely lost in loss record 1 of 43
    ==77924==    at 0x4C29BE3: malloc (vg_replace_malloc.c:299)
    ==77924==    by 0x41F20C: xmalloc (xmalloc.c:59)
    ==77924==    by 0x413351: rl_copy_text (util.c:155)
    ==77924==    by 0x416743: rl_delete_text (text.c:142)
    ==77924==    by 0x41683E: _rl_replace_text (text.c:192)
    ==77924==    by 0x406C9A: insert_match (complete.c:1839)
    ==77924==    by 0x4083B2: rl_complete_internal (complete.c:2055)
    ==77924==    by 0x408727: rl_complete (complete.c:438)
    ==77924==    by 0x403DCD: _rl_dispatch_subseq (readline.c:852)
    ==77924==    by 0x4040C8: _rl_dispatch (readline.c:798)
    ==77924==    by 0x404241: readline_internal_char (readline.c:632)
    ==77924==    by 0x4047B6: readline_internal_charloop (readline.c:659)
    ==77924==    by 0x4047B6: readline_internal (readline.c:671)
    ==77924==    by 0x4047B6: readline (readline.c:377)
    ==77924==
    ==77924== 12 bytes in 6 blocks are definitely lost in loss record 8 of 43
    ==77924==    at 0x4C29BE3: malloc (vg_replace_malloc.c:299)
    ==77924==    by 0x41F20C: xmalloc (xmalloc.c:59)
    ==77924==    by 0x413351: rl_copy_text (util.c:155)
    ==77924==    by 0x416743: rl_delete_text (text.c:142)
    ==77924==    by 0x417DFC: _rl_rubout_char (text.c:1219)
    ==77924==    by 0x417E44: rl_rubout (text.c:1179)
    ==77924==    by 0x403DCD: _rl_dispatch_subseq (readline.c:852)
    ==77924==    by 0x4040C8: _rl_dispatch (readline.c:798)
    ==77924==    by 0x404241: readline_internal_char (readline.c:632)
    ==77924==    by 0x4047B6: readline_internal_charloop (readline.c:659)
    ==77924==    by 0x4047B6: readline_internal (readline.c:671)
    ==77924==    by 0x4047B6: readline (readline.c:377)
    ==77924==    by 0x40325C: cmd_run() (cmd.cpp:342)
    ==77924==    by 0x402896: main (test-demo.cpp:98)
    ==77924==
    ==77924== LEAK SUMMARY:
    ==77924==    definitely lost: 14 bytes in 7 blocks
    ==77924==    indirectly lost: 0 bytes in 0 blocks
    ==77924==      possibly lost: 0 bytes in 0 blocks
    ==77924==    still reachable: 83,505 bytes in 133 blocks
    ==77924==         suppressed: 0 bytes in 0 blocks
    ==77924== Reachable blocks (those to which a pointer was found) are not shown.
    ==77924== To see them, rerun with: --leak-check=full --show-leak-kinds=all
     
    ==77526==
    ==77526== HEAP SUMMARY:
    ==77526==     in use at exit: 83,555 bytes in 139 blocks
    ==77526==   total heap usage: 511 allocs, 372 frees, 102,587 bytes allocated
    ==77526==
    ==77526== 102 (64 direct, 38 indirect) bytes in 2 blocks are definitely lost in loss record 19 of 44
    ==77526==    at 0x4C29BE3: malloc (vg_replace_malloc.c:299)
    ==77526==    by 0x41F2DC: xmalloc (xmalloc.c:59)
    ==77526==    by 0x4143FD: alloc_undo_entry (undo.c:77)
    ==77526==    by 0x4143FD: rl_add_undo (undo.c:94)
    ==77526==    by 0x416870: rl_delete_text (text.c:151)
    ==77526==    by 0x417ECC: _rl_rubout_char (text.c:1219)
    ==77526==    by 0x417F14: rl_rubout (text.c:1179)
    ==77526==    by 0x403DCD: _rl_dispatch_subseq (readline.c:852)
    ==77526==    by 0x4040C8: _rl_dispatch (readline.c:798)
    ==77526==    by 0x404241: readline_internal_char (readline.c:632)
    ==77526==    by 0x4047B6: readline_internal_charloop (readline.c:659)
    ==77526==    by 0x4047B6: readline_internal (readline.c:671)
    ==77526==    by 0x4047B6: readline (readline.c:377)
    ==77526==    by 0x40325C: cmd_run() (cmd.cpp:342)
    ==77526==    by 0x402896: main (test-demo.cpp:98)
    ==77526==
    ==77526== LEAK SUMMARY:
    ==77526==    definitely lost: 64 bytes in 2 blocks
    ==77526==    indirectly lost: 38 bytes in 4 blocks
    ==77526==      possibly lost: 0 bytes in 0 blocks
    ==77526==    still reachable: 83,453 bytes in 133 blocks
    ==77526==         suppressed: 0 bytes in 0 blocks
    ==77526== Reachable blocks (those to which a pointer was found) are not shown.
    ==77526== To see them, rerun with: --leak-check=full --show-leak-kinds=all

    Attachment: config.h
    Description: Binary data


    reply via email to

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