[asterisk-commits] russell: branch 1.4 r99187 - /branches/1.4/main/slinfactory.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 22 10:39:00 CST 2008


Author: russell
Date: Sat Jan 19 04:05:27 2008
New Revision: 99187

URL: http://svn.digium.com/view/asterisk?view=rev&rev=99187
Log:
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.

Modified:
    branches/1.4/main/slinfactory.c

Change Statistics:
 branches/1.4/main/slinfactory.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Modified: branches/1.4/main/slinfactory.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/slinfactory.c?view=diff&rev=99187&r1=99186&r2=99187
==============================================================================
--- branches/1.4/main/slinfactory.c (original)
+++ branches/1.4/main/slinfactory.c Sat Jan 19 04:05:27 2008
@@ -64,6 +64,7 @@
 			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 @@
 				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)))




More information about the asterisk-commits mailing list