NetBSD-Bugs archive

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

lib/51706: libedit memory leak - el_rread



>Number:         51706
>Category:       lib
>Synopsis:       libedit memory leak - el_rread
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 11 04:55:00 +0000 2016
>Originator:     Amir Plivatsky
>Release:        libedit
>Organization:
>Environment:
libedit-3.1-16.20160618cvs
>Description:
read_init() allocates el_read.
However, it is not freed in read_end() (which is called by el_end()).
>How-To-Repeat:
Run with LeakSanitizer.

==27324==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7ffff6efbe50 in malloc (/lib64/libasan.so.3+0xc6e50)
    #1 0x7ffff5c25ac2  (/lib64/libedit.so.0+0xfac2)

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

...
(gdb) b *0x7ffff5c25ac2
...
Breakpoint 3, read_init (el=el@entry=0x61a00001d480) at read.c:88
88		if ((el->el_read = el_malloc(sizeof(*el->el_read))) == NULL)

(gdb) p sizeof(*el->el_read)
$1 = 32


>Fix:
Add in read_end() before its end:

el_free(el_read);

(The following can be removed:
el_read->macros.macro = NULL;)




Home | Main Index | Thread Index | Old Index