[asterisk-bugs] [JIRA] (ASTERISK-22483) AST_LIST_INSERT_TAIL doesn't set field.next on added entry

Kinsey Moore (JIRA) noreply at issues.asterisk.org
Tue Oct 8 12:19:04 CDT 2013


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

Kinsey Moore commented on ASTERISK-22483:
-----------------------------------------

Looking over the patch and the comments above the macro, it appears that the absence of NULL setting is intentional. I'm going to spend some time digging into this to see if there's a good reason behind it since it will be a significant behavior change in the linked list API.

Coming at this from the other side, those pointers should probably already be set to NULL upon allocation and I'm going to attempt to reproduce this to find out where the allocations are coming from.
                
> AST_LIST_INSERT_TAIL doesn't set field.next on added entry
> ----------------------------------------------------------
>
>                 Key: ASTERISK-22483
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-22483
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Functions/func_config
>    Affects Versions: 11.5.1
>         Environment: FreeBSD 9.1, i386
>            Reporter: Brian Scott
>            Assignee: Kinsey Moore
>            Severity: Minor
>         Attachments: linkedlists.diff
>
>
> AST_LIST_INSERT_TAIL macro in include/asterisk/linkedlists.h doesn't set field.next to NULL when adding new entries to the tail of the list.
> Multiple calls to AST_CONFIG (for different files) in the dialplan causes Asterisk to crash in func_config with a memory error.
> Code appears to assume that malloc'ed memory would be initialised to NULL. This isn't a safe assumption on some systems (in this case FreeBSD).
> A trivial patch is available or you can work out where the (elm)->field.next = NULL; goes for yourself.
> Thanks

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list