summaryrefslogtreecommitdiff
path: root/main/frame.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2012-07-24 16:54:26 +0000
committerKevin P. Fleming <kpfleming@digium.com>2012-07-24 16:54:26 +0000
commitaf3ef19d006723daef84165f22ddeafc24ef37a6 (patch)
treed1b7af7ba615fd74057299b1d24cdb75654f4ae4 /main/frame.c
parentb74acabdc777bff52c30db9b1e99d481fad6a5eb (diff)
Rewrite a comment that didn't adequately explain the code it was documenting.
........ Merged revisions 370429 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 370430 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370431 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/frame.c')
-rw-r--r--main/frame.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/main/frame.c b/main/frame.c
index d2da73a8e..ddc74a183 100644
--- a/main/frame.c
+++ b/main/frame.c
@@ -491,8 +491,13 @@ struct ast_frame *ast_frdup(const struct ast_frame *f)
out->datalen = f->datalen;
out->samples = f->samples;
out->delivery = f->delivery;
- /* Set us as having malloc'd header only, so it will eventually
- get freed. */
+ /* Even though this new frame was allocated from the heap, we can't mark it
+ * with AST_MALLOCD_HDR, AST_MALLOCD_DATA and AST_MALLOCD_SRC, because that
+ * would cause ast_frfree() to attempt to individually free each of those
+ * under the assumption that they were separately allocated. Since this frame
+ * was allocated in a single allocation, we'll only mark it as if the header
+ * was heap-allocated; this will result in the entire frame being properly freed.
+ */
out->mallocd = AST_MALLOCD_HDR;
out->offset = AST_FRIENDLY_OFFSET;
if (out->datalen) {