[asterisk-bugs] [JIRA] (ASTERISK-29049) Memory Leak caused by fix for ASTERISK-28445

Joshua C. Colp (JIRA) noreply at issues.asterisk.org
Thu Aug 27 08:17:43 CDT 2020


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

Joshua C. Colp edited comment on ASTERISK-29049 at 8/27/20 8:15 AM:
--------------------------------------------------------------------

The ast_strdupa function is a wrapper around strdupa. This function does not require freeing, as it uses alloca underneath. The alloca function allocates from the stack and is automatically freed when the function exits. If you're experiencing a leak, it is unlikely this is the cause unless the alloca implementation is for some reason not adhering to the way it is supposed to behave.


was (Author: jcolp):
The ast_strdupa function is a wrapper around strdupa. This function does not require freeing, as it uses alloca underneath. The alloca function allocates from the stack and is automatically freed when the function exits.

> Memory Leak caused by fix for ASTERISK-28445
> --------------------------------------------
>
>                 Key: ASTERISK-29049
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29049
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: pjproject/pjsip
>    Affects Versions: 16.2.1
>            Reporter: Bernhard Schmidt
>            Assignee: Bernhard Schmidt
>
> I'm not exactly sure whether this affects recent versions where the patch has been merged upstream as well, I can't test that due to ASTERISK-29017 . But I haven't found any subsequent fixes so I think it is quite likely.
> In ASTERISK-28445 a one-line fix has been proposed and merged to fix a use-after-free in res_pjsip_session. Backporting this to 16.2.1 in Debian  the fix is leaking memory. Since the patch only changes one line to ast_strdupa a variable but doesn't free it anywhere that's probably the root cause.
> https://github.com/asterisk/asterisk/commit/fbc80db350ee006cdebcb113a6daf60f95c8851d#diff-abd0465e5ff1c7907e3b8826ce1dde80



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



More information about the asterisk-bugs mailing list