[asterisk-bugs] [JIRA] (ASTERISK-29878) chan_dahdi : memory leak in dahdi_restart

Frederic LE FOLL (JIRA) noreply at issues.asterisk.org
Mon Jan 24 06:25:06 CST 2022


    [ https://issues.asterisk.org/jira/browse/ASTERISK-29878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=257830#comment-257830 ] 

Frederic LE FOLL commented on ASTERISK-29878:
---------------------------------------------

Comments on valgrind3-AMI-DAHDIRestart-x1000-asterisk-18.6.0-libpri-1.6.0.txt:

1) valgrind execution shows that "main" memory leak" (occurs every time) is related to memory allocated by ast_cc_config_params_init() after chan_dahdi mkintf() function call, each time dahdi_restart() is executed.

This memory leak can be fixed in dahdi_restart() before memset(), by adding a loop that :
- checks cc_params fields in pris global array,
- calls ast_cc_config_params_destroy() when not NULL,

2) Both other memory leaks come from memory blocks allocated by Libpri pri_new() function, called by sig_pri sig_pri_start_pri() function here also due to dahdi_restart() execution.
- either allocated by pri_ctrl_new() (called by pri_new()) ; approx 25% occurrences,
- or allocated by pri_schedule_grow() (pri_ctrl_new => q921_start() => q921_establish_data_link() => reschedule_t200() => pri_schedule_event => pri_schedule_grow) : approx 70% occurrences.

> chan_dahdi : memory leak in dahdi_restart
> -----------------------------------------
>
>                 Key: ASTERISK-29878
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29878
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_dahdi
>    Affects Versions: 18.6.0
>         Environment: Asterisk 18.6.0
> Libpri 1.6.0
> TE820 card
>            Reporter: Frederic LE FOLL
>         Attachments: valgrind3-AMI-DAHDIRestart-x1000-asterisk-18.6.0-libpri-1.6.0.txt
>
>
> Each call to dahdi_restart() increases asterisk RES memory usage in "top".
> Test under valgrind with one single PRI span configured.
> dahdi_restart() called N times (1000 for test), either through AMI DAHDIRestart, or through CLI "dahdi restart".
> Result shows as many "definitely lost" blocks as dahdi_restart() executions.
> It also shows two other memory leaks with fewer occurrences (approximately 25% and 70% respectively.
> Issue initially opened with "minor" severity because dahdi_restart() usually is not a frequent operation.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list