[asterisk-dev] [Code Review] 4078: config: Fix SEGV in unit test with MALLOC_DEBUG

Matt Jordan reviewboard at asterisk.org
Tue Oct 14 12:00:24 CDT 2014


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



branches/12/main/config.c
<https://reviewboard.asterisk.org/r/4078/#comment24034>

    I'm not sure I'd dereference category after calling ast_category_destroy, even if its prev pointer is undisturbed. Since we've already assigned prev = category->prev, how about:
    
    if (config->last_browse == category) {
        config->last_browse = prev;
    }
    


- Matt Jordan


On Oct. 14, 2014, 11:06 a.m., George Joseph wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4078/
> -----------------------------------------------------------
> 
> (Updated Oct. 14, 2014, 11:06 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> With MALLOC_DEBUG the /main/config config_basic_ops test was causing a SEGV while doing an ast_category_delete in an ast_category_browse loop.  Apparently this never worked but was also never tested.  I removed the test, added 2 notes to config.h indicating that it's not supported and added a few lines of code to ast_category_delete to prevent the SEGV should someone attempt it in the future.  
> 
> 
> Diffs
> -----
> 
>   branches/12/tests/test_config.c 425404 
>   branches/12/main/config.c 425404 
>   branches/12/include/asterisk/config.h 425404 
> 
> Diff: https://reviewboard.asterisk.org/r/4078/diff/
> 
> 
> Testing
> -------
> 
> The unit tests pass now with MALLOC_DEBUG and the manager/config testsuite tests still passes.
> 
> 
> Thanks,
> 
> George Joseph
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20141014/ae300d03/attachment-0001.html>


More information about the asterisk-dev mailing list