[asterisk-dev] [Code Review] Fix XML documentation on non-Linux platforms.

Mark Michelson mmichelson at digium.com
Tue Mar 9 15:58:35 CST 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/536/#review1644
-----------------------------------------------------------



/trunk/main/xmldoc.c
<https://reviewboard.asterisk.org/r/536/#comment3661>

    I would suspect that if glob() fails on the second or further invocation, then prior to returning, you should call globfree(&globbuf) to free memory allocated from the previous glob() calls.
    
    Myy manpage isn't particularly clear on the matter, so it may be that glob() takes care of this itself and will never require memory to be freed if an error is returned.



/trunk/main/xmldoc.c
<https://reviewboard.asterisk.org/r/536/#comment3660>

    strsep changes where patternstr points. The most common result, assuming no glob errors, is that you are calling ast_free on a NULL pointer here. The end result is a memory leak.
    
    What you need to do is save a pointer to patternstr after patternstr is allocated and then call ast_free on the saved pointer. This actually applies just as equally for the other places in the code where you call ast_free on patternstr.
    
    An alternative would be to use alloca when allocating patternstr instead of ast_calloc. That way you don't have to worry about freeing the memory at all.


- Mark


On 2010-03-02 17:23:09, Jason Parker wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/536/
> -----------------------------------------------------------
> 
> (Updated 2010-03-02 17:23:09)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> Solaris glob() doesn't support GLOB_BRACE, so XML documentation wasn't being loaded.  Instead, let's switch to a slow and stupid method.
> 
> 
> This addresses bug 16688.
>     https://issues.asterisk.org/view.php?id=16688
> 
> 
> Diffs
> -----
> 
>   /trunk/main/xmldoc.c 249891 
> 
> Diff: https://reviewboard.asterisk.org/r/536/diff
> 
> 
> Testing
> -------
> 
> Documentation still loads as expected on Linux.
> 
> 
> Thanks,
> 
> Jason
> 
>




More information about the asterisk-dev mailing list