bugGNU nano - Bugs: bug #65505, setting an interface color twice...

 
 

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

bug #65505: setting an interface color twice leaks some memory

Submitter:  Benno Schulenberg <bens>
Submitted:  Fri 22 Mar 2024 02:50:18 PM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Open

Sat 23 Mar 2024 10:14:23 AM UTC, comment #1: 

Fixed in git, commit f4754bfb, by always first freeing 'color_combo[x]' before assigning it the specified value.

Benno Schulenberg <bens>
Group administrator
Fri 22 Mar 2024 02:50:18 PM UTC, original submission:  

To reproduce, compile nano with -fsanitize=address, then run:

echo "set statuscolor lightwhite,blue"  >doubled
echo "set statuscolor lightwhite,yellow"  >>doubled
src/nano --rc=doubled

Then type: ^X

31755==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f440ab77887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55cd619e020a in nmalloc /home/ben/Sources/NANO/src/utils.c:293

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

(For some reason valgrind does not detect this leak.)

The problem is, of course, that around line 1600 in src/rcfile.c each 'color_combo' gets simply assigned to, instead of first freeing a possibly already existing value.

(This is, of course, a very minor issue, because it's just a one-time leak.  But... it would be nice to not get unneeded complaints from the LeakSanitizer.)

Benno Schulenberg <bens>
Group administrator

 

(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 (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-03-23 bens StatusIn Progress Fixed
    2024-03-22 bens StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code