[asterisk-commits] file: trunk r182171 - /trunk/main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 16 08:58:27 CDT 2009


Author: file
Date: Mon Mar 16 08:58:24 2009
New Revision: 182171

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=182171
Log:
Fix a memory leak in the ast_answer / __ast_answer API call.

For a channel that is not yet answered this API call will wait
until a voice frame is received on the channel before returning.
It does this by waiting for frames on the channel and reading them
in. The frames read in were not freed when they should have been.

Modified:
    trunk/main/channel.c

Modified: trunk/main/channel.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/main/channel.c?view=diff&rev=182171&r1=182170&r2=182171
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Mon Mar 16 08:58:24 2009
@@ -1755,14 +1755,19 @@
 				}
 				f = ast_read(chan);
 				if (!f || (f->frametype == AST_FRAME_CONTROL && f->subclass == AST_CONTROL_HANGUP)) {
+					if (f) {
+						ast_frfree(f);
+					}
 					res = -1;
 					ast_debug(2, "Hangup of channel %s detected in answer routine\n", chan->name);
 					break;
 				}
 				if (f->frametype == AST_FRAME_VOICE) {
+					ast_frfree(f);
 					res = 0;
 					break;
 				}
+				ast_frfree(f);
 			}
 		}
 		break;




More information about the asterisk-commits mailing list