[asterisk-commits] russell: branch 1.4 r196826 - /branches/1.4/res/res_convert.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 26 13:14:45 CDT 2009


Author: russell
Date: Tue May 26 13:14:36 2009
New Revision: 196826

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=196826
Log:
Resolve a file handle leak.

The frames here should have always been freed.  However, out of luck, there was
never any memory leaked.  However, after file streams became reference counted,
this code would leak the file stream for the file being read.

(closes issue #15181)
Reported by: jkroon

Modified:
    branches/1.4/res/res_convert.c

Modified: branches/1.4/res/res_convert.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/res/res_convert.c?view=diff&rev=196826&r1=196825&r2=196826
==============================================================================
--- branches/1.4/res/res_convert.c (original)
+++ branches/1.4/res/res_convert.c Tue May 26 13:14:36 2009
@@ -100,9 +100,11 @@
 	
 	while ((f = ast_readframe(fs_in))) {
 		if (ast_writestream(fs_out, f)) {
+			ast_frfree(f);
 			ast_cli(fd, "Failed to convert %s.%s to %s.%s!\n", name_in, ext_in, name_out, ext_out);
 			goto fail_out;
 		}
+		ast_frfree(f);
 	}
 
 	cost = ast_tvdiff_ms(ast_tvnow(), start);
@@ -167,9 +169,11 @@
 	
 	while ((f = ast_readframe(fs_in))) {
 		if (ast_writestream(fs_out, f)) {
+			ast_frfree(f);
 			ast_cli(fd, "Failed to convert %s.%s to %s.%s!\n", name_in, ext_in, name_out, ext_out);
 			goto fail_out;
 		}
+		ast_frfree(f);
 	}
 
 	cost = ast_tvdiff_ms(ast_tvnow(), start);




More information about the asterisk-commits mailing list