bugGNU nano - Bugs: bug #61334, memory leak with --minibar when...

 
 

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

bug #61334: memory leak with --minibar when filename gets dottified

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Tue 12 Oct 2021 10:22:28 AM UTC  
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  Benno Schulenberg <bens> Open/Closed:  Open

Tue 12 Oct 2021 10:51:06 AM UTC, comment #2: 

Fixed in git, commit 7e807cdd, by using an extra variable for the shortened filename and freeing it after use.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Tue 12 Oct 2021 10:43:39 AM UTC, comment #1: 

The problem is this: 'thename = display_string(thename, ...'.  The filename string gets overwritten with another one without freeing it first.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Tue 12 Oct 2021 10:22:28 AM UTC, original submission:  

To reproduce, compile nano with -fsanitizer=address in the CFLAGS, then run:

src/nano --ignore -x --mini this-is-a-filename

Then make the terminal narrower until the filename becomes dottified ("...-is-a-filename "), then make the terminal its normal with again (to be able to read the output of the LeakSanitizer), and type ^X.  Result:

==15784==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 157 byte(s) in 1 object(s) allocated from:
    #0 0x7f75bc988b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x55993f005b56 in nmalloc /home/ben/Sources/NANO/src/utils.c:289
    #2 0x55993f00ee51 in display_string /home/ben/Sources/NANO/src/winio.c:1742
    #3 0x55993f011780 in minibar /home/ben/Sources/NANO/src/winio.c:2126
    #4 0x55993efd78ee in main /home/ben/Sources/NANO/src/nano.c:2516
    #5 0x7f75bc081bf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6)

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

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.

 

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 (Submitted the item)
  •  

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

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-10-12 bens StatusNone => Fixed
    2021-10-12 bens Summarymemory leak with --minibar when filename becomes dottified => memory leak with --minibar when filename gets dottified

    Back to the top


    Powered by Savane 3.7