diff options
author | Russell Bryant <russell@russellbryant.com> | 2008-01-19 10:06:02 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2008-01-19 10:06:02 +0000 |
commit | aa7592f21a5ec7c2ddd7b5e6e3c4e84f688736b6 (patch) | |
tree | bf32bf7349d214af27b67f7d9ff179a73e246f23 | |
parent | 3e1a2f99d1190b9b80d5a02f7ea4954ee4146de8 (diff) |
Merged revisions 99187 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r99187 | russell | 2008-01-19 04:05:27 -0600 (Sat, 19 Jan 2008) | 4 lines
Fix a couple of memory leaks with frame handling. Specifically,
ast_frame_free() needed to be called on the frame that came from the translator
to signed linear.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@99188 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | main/slinfactory.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/main/slinfactory.c b/main/slinfactory.c index 25d232a37..f8354603a 100644 --- a/main/slinfactory.c +++ b/main/slinfactory.c @@ -61,6 +61,7 @@ int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f) ast_translator_free_path(sf->trans); sf->trans = NULL; } + if (!sf->trans) { if (!(sf->trans = ast_translator_build_path(AST_FORMAT_SLINEAR, f->subclass))) { ast_log(LOG_WARNING, "Cannot build a path from %s to slin\n", ast_getformatname(f->subclass)); @@ -68,7 +69,15 @@ int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f) } sf->format = f->subclass; } - if (!(begin_frame = ast_translate(sf->trans, f, 0)) || !(duped_frame = ast_frdup(begin_frame))) + + if (!(begin_frame = ast_translate(sf->trans, f, 0))) + return 0; + + duped_frame = ast_frdup(begin_frame); + + ast_frfree(begin_frame); + + if (!duped_frame) return 0; } else { if (sf->trans) { |