[asterisk-dev] [Code Review] 2580: Consistent memory allocation by ast_bt_get_symbols
wdoekes
reviewboard at asterisk.org
Sat Jun 1 04:31:15 CDT 2013
> On June 1, 2013, 1:50 a.m., Russell Bryant wrote:
> > Soo ... why is this necessary?
Because it's broken? When
[X] MALLOC_DEBUG
[X] BETTER_BACKTRACES
memory was allocated with ast_calloc() and free'd with free().
If !MALLOC_DEBUG then ast_free==free, and if !BETTER_BACKTRACES then the memory was allocated with regular malloc().
I see now that https://reviewboard.asterisk.org/r/2567/diff/ does the inverse, and replaces the ast_calloc() calls with calloc() instead. That works too.
- wdoekes
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2580/#review8752
-----------------------------------------------------------
On May 31, 2013, 8:43 a.m., wdoekes wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2580/
> -----------------------------------------------------------
>
> (Updated May 31, 2013, 8:43 a.m.)
>
>
> Review request for Asterisk Developers.
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> ast_bt_get_symbols can return either an ast_malloc'd or a regular malloc'd list, depending on the value of BETTER_BACKTRACES.
>
> The result was always free'd (not ast_free'd).
>
> This patch:
> - copies the malloc'd list from backtrace_symbols into ast_malloc'd memory,
> - replaces the free's with ast_free's,
> - documents that the ast_bt_get_symbols return value should be freed.
>
> Unsure whether to put it in 1.8, since ast_bt_get_symbols() might be used by an external module.
>
>
> Diffs
> -----
>
> /trunk/main/utils.c 390180
> /trunk/main/logger.c 390180
> /trunk/main/astobj2.c 390180
> /trunk/include/asterisk/logger.h 390180
>
> Diff: https://reviewboard.asterisk.org/r/2580/diff/
>
>
> Testing
> -------
>
> Compile tested only.
>
>
> Thanks,
>
> wdoekes
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130601/ccf6d150/attachment.htm>
More information about the asterisk-dev
mailing list