diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-20 18:06:48 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-20 18:06:48 +0000 |
commit | b2d12f85251b611e5c223c8a8dd5a2c33e79c461 (patch) | |
tree | 5ab33adcd3b8ea1bc888882660bcbf6a487588b7 /include | |
parent | 93c58b4bdbdfa703e9fb4137b7dd01ce6df00075 (diff) |
There was an issue when attempting to reference an embedded
frame in a freed ast_filestream. This patch makes use of the
ao2 functions to make sure that we do not free an ast_filestream
structure until the embedded ast_frame has been "freed" as well.
(closes issue #13496)
Reported by: fst-onge
Patches:
filestream_frame_1_4.diff uploaded by putnopvut (license 60)
Tested by: putnopvut
Closes AST-89
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@158126 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/file.h | 15 | ||||
-rw-r--r-- | include/asterisk/frame.h | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/asterisk/file.h b/include/asterisk/file.h index 636309bc4..52b0a9f18 100644 --- a/include/asterisk/file.h +++ b/include/asterisk/file.h @@ -402,6 +402,21 @@ off_t ast_tellstream(struct ast_filestream *fs); */ struct ast_frame *ast_readframe(struct ast_filestream *s); +/*!\brief destroy a filestream using an ast_frame as input + * + * This is a hack that is used also by the ast_trans_pvt and + * ast_dsp structures. When a structure contains an ast_frame + * pointer as one of its fields. It may be that the frame is + * still used after the outer structure is freed. This leads to + * invalid memory accesses. This function allows for us to hold + * off on destroying the ast_filestream until we are done using + * the ast_frame pointer that is part of it + * + * \param fr The ast_frame that is part of an ast_filestream we wish + * to free. + */ +void ast_filestream_frame_freed(struct ast_frame *fr); + /*! Initialize file stuff */ /*! * Initializes all the various file stuff. Basically just registers the cli stuff diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h index 30686efde..6ee131eb2 100644 --- a/include/asterisk/frame.h +++ b/include/asterisk/frame.h @@ -135,6 +135,10 @@ enum { * The dsp cannot be free'd if the frame inside of it still has * this flag set. */ AST_FRFLAG_FROM_DSP = (1 << 2), + /*! This frame came from a filestream and is still the original frame. + * The filestream cannot be free'd if the frame inside of it still has + * this flag set. */ + AST_FRFLAG_FROM_FILESTREAM = (1 << 3), }; /*! \brief Data structure associated with a single frame of data |