bugGNU nano - Bugs: bug #47124, memory leak w/status bar

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #47124: memory leak w/status bar

Submitter:  Mike Frysinger <vapier>
Submitted:  Thu 11 Feb 2016 11:59:33 PM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Jump to the original submission

Sat 20 Feb 2016 12:19:08 PM UTC, comment #6: 

Fixed in SVN, r5653.

Thanks for reporting.

Benno Schulenberg <bens>
Group administrator
Sat 20 Feb 2016 10:42:06 AM UTC, comment #5: 

Okay, I get it now.  When tabbing on a string that has no completion, get_history_completion() simply returns the passed string.  What then happens is 'answer = mallocstrcpy(answer, answer) -- destination equals source, destination is not freed and reallocated, so source is lost.

Solution is probably to do the mallocstrcpy() in get_history_completion().

Benno Schulenberg <bens>
Group administrator
Fri 19 Feb 2016 08:02:00 PM UTC, comment #4: 

The loss happens somewhere in get_history_completion().

Benno Schulenberg <bens>
Group administrator
Fri 19 Feb 2016 11:44:31 AM UTC, comment #3: 

Finally found a way to reproduce this (because of typing the wrong key while trying to reproduce something else):

Start nano, and type:  ^W  www  <Tab>  ^C  ^X.

==2812== 4 bytes in 1 blocks are definitely lost in loss record 15 of 476
==2812==    at 0x4025016: realloc (vg_replace_malloc.c:525)
==2812==    by 0x806101F: nrealloc (utils.c:400)
==2812==    by 0x805910F: do_statusbar_output (prompt.c:288)
==2812==    by 0x8059317: do_statusbar_input (prompt.c:125)
==2812==    by 0x80595C1: get_prompt_string (prompt.c:593)
==2812==    by 0x80598CD: do_prompt (prompt.c:764)
==2812==    by 0x805C50D: search_init (search.c:164)
==2812==    by 0x805C87C: do_search (search.c:425)
==2812==    by 0x8057BC5: do_input (nano.c:1722)
==2812==    by 0x8058719: main (nano.c:2681)

The number of bytes lost is the number of characters typed before <Tab> plus one.

Benno Schulenberg <bens>
Group administrator
Sat 13 Feb 2016 01:03:02 AM UTC, comment #2: 

i did hit up to go to a recent match, then tried a few keystrokes to try and delete some words (like alt+d) which didn't work.  i don't recall the exact sequence or keys or i would post them :).

Mike Frysinger <vapier>
Group Member
Fri 12 Feb 2016 10:39:54 AM UTC, comment #1: 

Cannot reproduce.  What did you search for?  In which file?  Did you use <Up> to retrieve an earlier search string, did you edit the retrieved string?

Benno Schulenberg <bens>
Group administrator
Thu 11 Feb 2016 11:59:33 PM UTC, original submission:  

=================================================================
==1587==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x7fbd46f2436a in realloc (.../libasan.so.2+0x9d36a)
    #1 0x455d4e in nrealloc .../utils.c:400
    #2 0x435ad1 in do_statusbar_output .../prompt.c:301
    #3 0x434b2f in do_statusbar_input .../prompt.c:134
    #4 0x436ddf in get_prompt_string .../prompt.c:613
    #5 0x43787f in do_prompt .../prompt.c:784
    #6 0x43ed73 in search_init .../search.c:164
    #7 0x44007d in do_search .../search.c:427
    #8 0x42ff29 in do_input .../nano.c:1724
    #9 0x4343d2 in main .../nano.c:2680
    #10 0x7fbd462465ef in __libc_start_main (/lib64/libc.so.6+0x205ef)

SUMMARY: AddressSanitizer: 10 byte(s) leaked in 1 allocation(s).

Mike Frysinger <vapier>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by vapier (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-27 bens Open/ClosedOpen Closed
    2016-02-20 bens StatusIn Progress Fixed
    2016-02-19 bens StatusNone In Progress
    2016-02-12 bens Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code