[Asterisk-Dev] potentially nasty bugs in string pools usage

Kevin P. Fleming kpfleming at digium.com
Fri Jan 6 13:05:02 MST 2006


Luigi Rizzo wrote:

> you are commenting the realloc problem, which is simmple to solve as
> it was suggested before - don't use realloc, and if you need more
> memory allocate a new block linked to the previous one.

Yes, that's a good solution. I'll do that.

> what _I_ was addressing (I admit, i could have been more clear)
> is the locking problem when two threads are trying
> to use the allocator on the same structure. This doesn't affect
> already allocated strings.

String manipulation in these structures is already protected by the 
structure's lock, so using 'string fields' vs. regular buffers does not 
change the semantics.

> if you are really anxious about hiding, you can use the first level
> macro, ast_string_field_build(), to pass as many parameters as needed
> to the actual var-adic function.

Already done in trunk :-)



More information about the asterisk-dev mailing list