[asterisk-dev] Re: [asterisk-commits] russell: branch 1.2r38288 - /branches/1.2/channels/chan_sip.c

Paul Cadach paul at odt.east.telecom.kz
Thu Jul 27 00:57:42 MST 2006


Hello,

Russell Bryant wrote:
> > Alternatively, since we have ast_malloc/ast_calloc, should we have ast_free
(not in 1.2, of course)?
>
> I suppose.  However, I'm not sure how beneficial it would be other than
> for matching the naming convention of the allocation wrappers.  There is
> obviously no error checking we can do on a call to free(), so we can't
> inject an Asterisk log message or anything.

There is possible to provide some sort of memory checks in allocation wrappers,
like:
  <offset>-4: Some magic data to check if allocated block is not underbounded
  <offset>: Memory for data returned by ast_malloc()/ast_calloc() call;
  <offset>+n: Some magic data to check if allocated block is not overwritten;

For such memory check you should have special free() function which will check
magic data before and after allocated data, and call to real free() function
with modified pointer.


WBR,
Paul.




More information about the asterisk-dev mailing list