[asterisk-dev] [Code Review] Fixes dealing with misuse of asprintf()

rmudgett reviewboard at asterisk.org
Fri Aug 17 10:59:32 CDT 2012


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



/branches/1.8/funcs/func_odbc.c
<https://reviewboard.asterisk.org/r/2071/#comment13518>

    Compiler error:
    *query->acf->name = NULL;
    
    Should be:
    (*query)->acf->name = NULL;


- rmudgett


On Aug. 16, 2012, 6:21 p.m., Mark Michelson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2071/
> -----------------------------------------------------------
> 
> (Updated Aug. 16, 2012, 6:21 p.m.)
> 
> 
> Review request for Asterisk Developers and rmudgett.
> 
> 
> Summary
> -------
> 
> This contains several fixes involving the misuse of asprintf()
> 
> * All uses of asprintf() have been changed to ast_asprintf() and all uses of vasprintf() have been changed to ast_vasprintf(). This is because these are typically paired with calls to ast_free(). When using MALLOC_DEBUG, we must pair ast_ allocation calls with ast_free() or else unfun things happen.
> 
> * All uses of ast_asprintf() are now checked for failure. The biggest offender here was xmldoc.c. If there are errors in this review, this is the most likely file to find them.
> 
> * Any failure cases of ast_asprintf() that result in the allocated memory being potentially referenced later now explicitly NULLs out the pointer because asprintf() does not define what the pointer will be pointing to after an allocation failure.
> 
> * Fixed a memory leak in res_config_sqlite3 where an ast_asprintf() call did not have the resultant allocated memory freed.
> 
> 
> This addresses bug ASTERISK-20135.
>     https://issues.asterisk.org/jira/browse/ASTERISK-20135
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/main/file.c 371391 
>   /branches/1.8/main/utils.c 371391 
>   /branches/1.8/main/xmldoc.c 371391 
>   /branches/1.8/pbx/pbx_config.c 371391 
>   /branches/1.8/res/res_config_sqlite.c 371391 
>   /branches/1.8/res/res_jabber.c 371391 
>   /branches/1.8/channels/chan_sip.c 371391 
>   /branches/1.8/funcs/func_odbc.c 371391 
>   /branches/1.8/apps/app_dial.c 371391 
>   /branches/1.8/apps/app_queue.c 371391 
>   /branches/1.8/apps/app_stack.c 371391 
>   /branches/1.8/cdr/cdr_tds.c 371391 
>   /branches/1.8/channels/chan_dahdi.c 371391 
>   /branches/1.8/channels/chan_oss.c 371391 
> 
> Diff: https://reviewboard.asterisk.org/r/2071/diff
> 
> 
> Testing
> -------
> 
> Compiled, ran Asterisk, and ran some calls. Nothing catastrophic occurred.
> 
> 
> Thanks,
> 
> Mark
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120817/0343fdd1/attachment-0001.htm>


More information about the asterisk-dev mailing list