[asterisk-commits] irroot: branch irroot/t38gateway-trunk r336156 - /team/irroot/t38gateway-trun...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 15 14:27:05 CDT 2011


Author: irroot
Date: Thu Sep 15 14:27:04 2011
New Revision: 336156

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=336156
Log:
Changes to WaitFax free frames when queueing them preventing a leak

Modified:
    team/irroot/t38gateway-trunk/res/res_fax.c

Modified: team/irroot/t38gateway-trunk/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-trunk/res/res_fax.c?view=diff&rev=336156&r1=336155&r2=336156
==============================================================================
--- team/irroot/t38gateway-trunk/res/res_fax.c (original)
+++ team/irroot/t38gateway-trunk/res/res_fax.c Thu Sep 15 14:27:04 2011
@@ -3097,7 +3097,7 @@
 	int res = 0;
 	int dspnoise = 0;
 	struct ast_dsp *dsp = NULL;
-	struct ast_frame *f;
+	struct ast_frame *f, *dup_f;
 	enum ast_t38_state t38state = T38_STATE_UNKNOWN;
 	struct ast_format orig_read_format;
 	AST_LIST_HEAD_NOLOCK(, ast_frame) deferred_frames;
@@ -3115,13 +3115,13 @@
 			}
 	}
 
-	if ((dsp = ast_dsp_new())) {
-		ast_dsp_set_features(dsp, DSP_FEATURE_FAX_DETECT);
-		ast_dsp_set_faxmode(dsp, DSP_FAXMODE_DETECT_CNG | DSP_FAXMODE_DETECT_SQUELCH);
-		ast_dsp_set_threshold(dsp, ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE));
-	} else {
+	if (!(dsp = ast_dsp_new())) {
 		return -1;
 	}
+
+	ast_dsp_set_features(dsp, DSP_FEATURE_FAX_DETECT);
+	ast_dsp_set_faxmode(dsp, DSP_FAXMODE_DETECT_CNG | DSP_FAXMODE_DETECT_SQUELCH);
+	ast_dsp_set_threshold(dsp, ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE));
 
 	AST_LIST_HEAD_INIT_NOLOCK(&deferred_frames);
 
@@ -3164,7 +3164,11 @@
 
 	ast_channel_lock(chan);
 	while ((f = AST_LIST_REMOVE_HEAD(&deferred_frames, frame_list))) {
-		ast_queue_frame_head(chan, ast_frisolate(f));
+		dup_f = ast_frisolate(f);
+		ast_queue_frame_head(chan, dup_f);
+		if (dup_f != f) {
+			ast_frfree(f);
+		}
 	}
 	ast_channel_unlock(chan);
 




More information about the asterisk-commits mailing list