diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-19 10:05:27 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-19 10:05:27 +0000 |
commit | e3dc6b3dffceaaa86697ee4accde5b787e826550 (patch) | |
tree | 337557a244c46f8165af6d65ed17fde7f7ec5b43 /main/slinfactory.c | |
parent | 9115686255f1adefa36a37ef5b1a1225bae8bdd3 (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.4@99187 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/slinfactory.c')
-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 5061a609e..03f6dcae8 100644 --- a/main/slinfactory.c +++ b/main/slinfactory.c @@ -64,6 +64,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)) == NULL) { ast_log(LOG_WARNING, "Cannot build a path from %s to slin\n", ast_getformatname(f->subclass)); @@ -72,7 +73,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 (!(duped_frame = ast_frdup(f))) |