[asterisk-dev] [Code Review]: Fix memory leak in error paths for action_originate().

rmudgett reviewboard at asterisk.org
Wed Jan 25 11:46:31 CST 2012



> On Jan. 25, 2012, 10:58 a.m., Matt Jordan wrote:
> > /branches/1.8/main/manager.c, line 3655
> > <https://reviewboard.asterisk.org/r/1690/diff/1/?file=23605#file23605line3655>
> >
> >     I'm not sure I agree with this change.  For read purposes, string fields are treated as const char * const - for write purposes, you have to use the string field API.  The data field ends up being passed as a void * to ast_request - and its up to the individual channel drivers to interpret them.
> >     
> >     A channel driver may assume that they can cast this to a char and modify the internals of the string field, going outside of the normal string field API calls.

Channel drivers should not do that anyway precisely because they cannot make an assumption about the buffer they are dealing with.

I have not seen a channel driver or most other parsing functions in Asterisk that did not first copy the string into a local buffer for dissecting.


- rmudgett


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


On Jan. 25, 2012, 10:43 a.m., rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1690/
> -----------------------------------------------------------
> 
> (Updated Jan. 25, 2012, 10:43 a.m.)
> 
> 
> Review request for Asterisk Developers and Mark Michelson.
> 
> 
> Summary
> -------
> 
> * Fix memory leak of vars in error paths for action_originate().
> 
> * Moved struct fast_originate_helper tech and data members to stringfields.
> 
> * Simplified ActionID header handling for fast_originate().
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/main/manager.c 352510 
> 
> Diff: https://reviewboard.asterisk.org/r/1690/diff
> 
> 
> Testing
> -------
> 
> It compiles. :)
> 
> 
> Thanks,
> 
> rmudgett
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120125/d3050e7a/attachment.htm>


More information about the asterisk-dev mailing list