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

 
 

bug #47124: memory leak w/status bar

Submitted by:  Mike Frysinger <vapier>
Submitted on:  Thu 11 Feb 2016 11:59:33 PM UTC  
 
Severity: 3 - NormalStatus: Fixed
Assigned to: Benno Schulenberg <bens>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission 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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
Fri 19 Feb 2016 08:02:00 PM UTC, comment #4:

The loss happens somewhere in get_history_completion().

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project 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>
Project AdministratorIn charge of this item.
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>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 27 Feb 2016 03:04:11 PM UTCbensOpen/ClosedOpen=>Closed
    Sat 20 Feb 2016 12:19:08 PM UTCbensStatusIn Progress=>Fixed
    Fri 19 Feb 2016 08:02:00 PM UTCbensStatusNone=>In Progress
    Fri 12 Feb 2016 10:39:54 AM UTCbensAssigned toNone=>bens

    Back to the top


    Powered by Savane 3.1-cleanup1