[Home]

Summary:ASTERISK-27974: core: Leaksanitizer reports libedit2 el_set EL_ADDFN wcsdup leaks
Reporter:Walter Doekes (wdoekes)Labels:
Date Opened:2018-07-19 04:02:54Date Closed:2018-07-19 04:16:33
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:13.22.0 15.5.0 16.0.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When running the asterisk console with the leak sanitizer enabled, you may see this:
{noformat}
hostname*CLI> quit
Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups

=================================================================
==22860==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 120 byte(s) in 2 object(s) allocated from:
   #0 0x7f855ee95bcf in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/liblsan.so.0+0xebcf)
   #1 0x7f855cdaa3ee in wcsdup (/usr/lib/x86_64-linux-gnu/libedit.so.2+0x183ee)

SUMMARY: LeakSanitizer: 120 byte(s) leaked in 2 allocation(s).
{noformat}
Those leaks are caused by:
{code}
el_set(el, EL_ADDFN, "ed-complete", "Complete argument", cli_complete);
{code}
But they're not an asterisk problem, but a libedit2-problem.

It is documented in the libedit2 code (the Strdup is a macro around wcsdup):
{code}
       case EL_ADDFN: {          /* const char *, const char *, el_func_t */
...
               // XXX: The two strdup's leak
               ret = map_addfunc(el, Strdup(wargv[0]), Strdup(wargv[1]),
                   func);
               ct_free_argv(wargv);
               break;
{code}

Nothing to fix on the asterisk side. Just reporting it so we have something to point to when the issue is observed.

Other projects have also reported this. For instance:
https://freeswitch.org/jira/si/jira.issueviews:issue-html/FS-11131/FS-11131.html ("\[FS-11131\] Memory Leak with libedit")
Comments:By: Asterisk Team (asteriskteam) 2018-07-19 04:02:56.320-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Joshua C. Colp (jcolp) 2018-07-19 04:16:33.907-0500

Marking this as won't fix then, since there's nothing we can do.