[asterisk-dev] ast_frame allocation/free question

Kevin P. Fleming kpfleming at digium.com
Tue Nov 27 17:23:29 CST 2007


Simon Perreault wrote:

> 1) The channel makes a copy of the frame for sending later, and takes charge 
> of freeing the copy.
> 
> 2) ast_write() is synchronous and the frame is no longer needed once it 
> returns.
> 
> Which is it?

Why does it matter how the channel driver works internally? In either of
those scenarios, the ast_frame that you have a pointer to (that you
passed to ast_write()) is your responsibility once ast_write() returns
to you.

To answer your question though, there are some channel drivers that are
#1 and some that are #2.

I'm actually not sure why this ever came up, since the (admittedly
minimal) documentation in channel.h does not give anyone the impression
that ast_write() takes ownership of the frame. If it did so it would
certainly be our policy to document such non-obvious behavior.

-- 
Kevin P. Fleming
Director of Software Technologies
Digium, Inc. - "The Genuine Asterisk Experience" (TM)



More information about the asterisk-dev mailing list